Unix Questions and Answers – Process Basics

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

Answer: b
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

Answer: a
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

Answer: b
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.
advertisement
advertisement

4. Programs and process are synonymous.
a) True
b) False
View Answer

Answer: b
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

Answer: a
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.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

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

Answer: c
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

Answer: b
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.
advertisement

8. Each process is identified by a unique integer called ______
a) PID
b) PPID
c) TID
d) PTID
View Answer

Answer: a
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

Answer: a
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.
advertisement

10. The parent id of a child is called ______
a) PID
b) PPID
c) TID
d) PTID
View Answer

Answer: b
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

Answer: a
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

Answer: a
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

Answer: b
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

Answer: b
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

Answer: d
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.

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.