This set of Unix Multiple Choice Questions & Answers (MCQs) focuses on “Process Basics”.
1. A process is an instance of _______ program.
a) waiting
b) executing
c) terminated
d) halted
View Answer
Explanation: A process is simply an instance of a running program. A process passes through many states throughout its life cycle i.e. when it is born until it is executed. After the process has completed it is said to be terminated.
2. A process is said to be ____ when it starts its execution.
a) born
b) die
c) waiting
d) terminated
View Answer
Explanation: A process is said to be born when it starts its execution. It is the initial state of a process. The process is assigned to CPU for its execution further.
3. When the process has completed its execution it is called ______
a) born
b) terminated
c) waiting
d) exit
View Answer
Explanation: A process is said to be died or terminated when it has completed its execution either normally or abnormally. As long as the process is running it is in an active state but as soon as the process has completed its execution, the process is said to die.
4. Programs and process are synonymous.
a) True
b) False
View Answer
Explanation: Program should not be confused with the process. Both differ from each other but very slightly. The process is only an instance of a running program. Until a program hasn’t started its execution it is referred to a program only but as soon it is in execution state it is called as a process.
5. Which data structure is used to store information about a process?
a) process control block (pcb)
b) array
c) queue
d) program control block
View Answer
Explanation: A process control block is a data structure which is used for storing information about a process. It is also known as task control block and is maintained by the kernel for maintenance of a process. Each process has its own pcb.
6. Some attributes of every process are maintained by the kernel in memory in a separate structure called the ______
a) pcb
b) task control block
c) process table
d) task table
View Answer
Explanation: As every process has some attributes. Some of these attributes are maintained by the kernel in memory in a separate structure called the process table. A process table is simply an array of many pcb’s. Process table contains two major attributes of a process i.e. processed and parent process ID.
7. Process table and process control block store same attributes of a process.
a) True
b) False
View Answer
Explanation: Both pcb and process table store attributes and information about processes. But the major difference between both is, pcb contains all the information about the process and is used in context switching while process table contains very few attributes of a process like registers, pid, parent pid.
8. Each process is identified by a unique integer called ______
a) PID
b) PPID
c) TID
d) PTID
View Answer
Explanation: Each process is uniquely identified by a unique integer called as the Process ID (PID) which is allotted by the kernel when the process is born. This PID is used for controlling the process of killing it.
9. Every process has a parent process.
a) True
b) False
View Answer
Explanation: Just like a file has a parent, every process also has the same. The parent is also a process and the process born from it is called child process. For example, when we run the cat command a process representing the cat command is started by the shell process. The process started by the shell is called child process and the shell (which could be sh, ksh or any other) is the parent process.
10. The parent id of a child is called ______
a) PID
b) PPID
c) TID
d) PTID
View Answer
Explanation: The parent ID of a child process is called PPID (parent process ID) and is available as a process attribute. It is common that several processes have the same parent. When several processes have the same parent, it often makes sense to kill the parent process rather than killing each child separately.
11. Which process is immediately set up by the kernel when we log on to a UNIX system?
a) shell
b) parent
c) shell
d) bash
View Answer
Explanation: As we log on to a UNIX system, a process is immediately set up by the kernel. This process represents a UNIX command which may sh (Bourne shell), ksh (Korn shell), csh (C shell) or bash (Bash). This process remains alive until we log out when it is killed by the kernel.
12. To know the PID of your current shell, which command will be used?
a) echo $$
b) echo $
c) $SHELL
d) $PATH
View Answer
Explanation: The shell’s pathname is stored in SHELL, but it’s PID is stored in a special variable, $$. To know the PID of our current shell, type
$ echo $$ 258 // PID of the current shell
13. The PID of our login shell doesn’t change.
a) True
b) False
View Answer
Explanation: The PID of our login shell can’t obviously change as long as we are logged in. But when we log out and log in again, our login shell will be assigned a different PID. This knowledge of PID is necessary to control the activities at our terminal.
14. What is the PID of the first process that is set up when the system is booted?
a) 1
b) 0
c) any
d) 2
View Answer
Explanation: Every process has a parent process, we can’t have any orphaned process for a longer time. The ancestry of every process is ultimately traced to the first process (PID 0) that is set up when the system is booted. It’s like the root directory of the system.
15. Which of the following command doesn’t create a process?
a) pwd
b) fork
c) cd
d) pwd and cd
View Answer
Explanation: When we run a command, a process representing the command is started by the shell process but all commands don’t set up processes. Built-in commands of the shell like pwd, cd etc do not create processes.
Sanfoundry Global Education & Learning Series – Unix.
To practice all areas of Unix, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Check Computer Science Books
- Check MCA Books
- Practice MCA MCQs
- Practice Computer Science MCQs
- Check Unix Books