This set of Unix Multiple Choice Questions & Answers (MCQs) focuses on “Process Control Basics”.
1. UNIX supports preemptive multitasking.
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
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.
Explanation: The virtual address space consists of a number of segments which are:
• Text segment
• Data segment
• Command line arguments and environment variables.
4. The segment representing the constants, globals and static variables is called:
a) text segment
b) data segment
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
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.
6. The attributes of every process are stored in ____
a) data table
b) inode table
c) process table
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.
Explanation: The entire process life cycle is built around four system calls – fork, exec (not actually a system call), wait and _exit.
8. Which of the following system call is used for replicating a process?
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?
d) getenv and setenv
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.
10. A process can be terminated using the exit or _exit system call.
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.
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.
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?
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 ____
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.
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.