250+ TOP MCQs on Process Handling Commands and Answers

Unix Multiple Choice Questions on “Process Handling Commands”.

1. We can run the jobs in the background in UNIX.
a) True
b) False

Answer: a
Clarification: Since UNIX is a multitasking system, it allows the user to do more than one job at a time. But there can be only one process in the foreground and the rest of jobs have to run in the background.

2. Shell ___ operator is used for running jobs in the background.
a) $
b) #
c) |
d) &

Answer: d
Clarification: The & is the shell operator used to run a process in the background. All we have to do is to terminate the command line with a & symbol, the command will automatically run in the background. For example,

$ sort  -o  emp.lst  &        // emp.lst will be sorted but the command will run in background

3. Which command is used for running jobs in the background?
a) nice
b) ps
c) nohup
d) exec

Answer: c
Clarification: The nohup command when prefixed to a command allows execution of the process even after the user has logged out of the system. Background jobs cease to run when a user logs out of the system. This happens because the shell is killed. To avoid this condition, the nohup command can be used. For example,

4. It is necessary to terminate the command line with &, even when we are using nohup command.
a) True
b) False

Answer: a
Clarification: nohup command allows running jobs in the background even when the user logs out of the system. But it is necessary to terminate the command line with & when using nohup command.

5. Which of the following shell(s) allows the user to run jobs in the background even when the user has logged out (without using nohup command)?
a) C
b) bash
c) Korn
d) C and bash

Answer: d
Clarification: Background jobs are terminated automatically when the user logs out. But in C shell and bash shell jobs are not terminated even after the user logs out. While this is not the case with Bourne and Korn shells. In these shells, jobs are aborted as soon as the user logs out.

6. When nohup command is used, shells returns the _____
a) PID
b) PPID
c) tty
d) TTy

Answer: a
Clarification: When the nohup command is used, the shell returns the PID and some shells also display a message. For example,

$ nohup sort  emp.lts &
859                             // PID returned by the shell
Sending output to nohup.out    //message displayed

7. nohup command doesn’t send the standard output of a command to any file.
a) True
b) False

Answer: b
Clarification: Some shells display a message when the nohup command is used. In these shells, nohup command sends the standard output of the command to the file nohup.out. If you don’t get this message then you have to make sure that you’ve taken care of the output using redirection, if necessary.

8. What is the PID of the process who takes the parentage of the process run with nohup command?
a) 0
b) 1
c) 2
d) Infinite

Answer: b
Clarification: The shell dies on logging out but it’s child didn’t. The kernel handles such situations by reassigning the PPID of the orphan process to the system’s init process (PID 1), which is the parent of all shells.

9. Which command is used for executing jobs according to their priority?
a) nohup
b) $
c) &
d) nice

Answer: d
Clarification: Processes in UNIX system are usually executed with equal priority but sometimes it is necessary to complete high priority jobs at the earliest. For this purpose, UNIX offers nice command. For example,

10. It is better to use & with nice command.
a) True
b) False

Answer: a
Clarification: UNIX offers the nice command, which is used with the & operator to increase the priority of jobs. More important jobs can have greater access to the system resources.

Leave a Reply

Your email address will not be published. Required fields are marked *