Unix Questions and Answers – Process Control Basics

This set of Unix Multiple Choice Questions & Answers (MCQs) focuses on “Process Control Basics”.

1. UNIX supports preemptive multitasking.
a) True
b) False
View Answer

Answer: a
Explanation: UNIX supports preemptive multitasking, which means that the kernel pre-empts the process when its time period expires.

2. The collection of memory locations that the process can access is called _______
a) process table
b) process space
c) virtual address space
d) virtual space
View Answer

Answer: c
Explanation: Processes have their origin in executable program files on disk. The collection of memory locations that a process can access is called virtual address space. It is organized into a number of segments.

3. The virtual address space consists of ____ segments.
a) 4
b) 5
c) 3
d) 2
View Answer

Answer: b
Explanation: The virtual address space consists of a number of segments which are:
• Text segment
• Data segment
• Stack
• Heap
• Command line arguments and environment variables.
advertisement
advertisement

4. The segment representing the constants, globals and static variables is called:
a) text segment
b) data segment
c) stack
d) heap
View Answer

Answer: b
Explanation: The segment representing the constants, globals and static variables which are used in the program is called data segment.

5. The stack stores the _______
a) arguments and local variables
b) address to return to
c) global variables
d) arguments and local variables and address to return
View Answer

Answer: d
Explanation: The stack stores the arguments and the local variables of function as well as the address to return to. It grows and shrinks in size as functions are involved and complete execution.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. The attributes of every process are stored in ____
a) data table
b) inode table
c) process table
d) heap
View Answer

Answer: c
Explanation: The attributes of a process are stored in a fairly large data structure that represents an entry in the process table.

7. The entire process life cycle is built around ___ system calls.
a) 3
b) 4
c) 2
d) 5
View Answer

Answer: b
Explanation: The entire process life cycle is built around four system calls – fork, exec (not actually a system call), wait and _exit.
advertisement

8. Which of the following system call is used for replicating a process?
a) fork
b) exec
c) wait
d) _exit
View Answer

Answer: a
Explanation: The forking mechanism of process creation uses the fork system call to create a process. Each process is assigned a PID which is used for process handling purposes.

9. Which of the following functions is used for handling environment variables of a process?
a) getenv
b) setenv
c) letenv
d) getenv and setenv
View Answer

Answer: d
Explanation: Forking mechanism also transmits the parent’s environment to the child since environment variables are constituents of parent’s address space. POSIX specifies two functions getenv and setenv for handlings environment variables.
advertisement

10. A process can be terminated using the exit or _exit system call.
a) True
b) False
View Answer

Answer: a
Explanation: If we place the exit or _exit system call anywhere in the program, the process will terminate as soon as that statement is executed.

11. Both exit and _exit system call share an identical syntax.
a) True
b) False
View Answer

Answer: a
Explanation: exit and _exit are one of the four basic system calls used in the process life cycle. They both share an identical syntax.

void _exit (int status;)
void exit (int status);

12. The parent process picks up the exit status of a child using ___ system call.
a) wait
b) waitp
c) exec
d) kill
View Answer

Answer: a
Explanation: When a child process terminates, its exit status is placed along with other information in the process table. The parent picks this exit status using the wait system call.

13. Which of the following system call is more powerful (in waiting mechanism) than wait system call?
a) waitp
b) waitpid
c) kill
d) run
View Answer

Answer: b
Explanation: wait system call suffers from a number of limitations. It blocks until a child dies and if a parent spawns several children, wait returns the moment one of them dies. Wait also can’t handle process group. For these reasons, the waitpid system call is used.

14. If the child dies first but the entry of that child in the process table is still present, then that process is called ____
a) orphan
b) zombie
c) termin
d) daemon
View Answer

Answer: b
Explanation: If the child dies first but the entry of that child in the process table is still presnt, then that process is said to be zombie state.

15. Every process belongs to a process group.
a) True
b) False
View Answer

Answer: a
Explanation: Every process belongs to a process group. Each process in the group has the same process group-id. The group has a leader whose process group ID is same as its PID.

Sanfoundry Global Education & Learning Series – Unix.

To practice all areas of Unix, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.