250+ TOP MCQs on Process Handling Commands and Answers

Unix Questions and Answers for Entrance exams on “Process Handling Commands”.

1. nice command is a ______ command in C shell.
a) internal
b) external
c) built-in
d) directory

Answer: c
Clarification: nice is a built-in command in the C shell. nice values are system-dependent and typically range from 1 to 19. A higher nice value implies a lower priority. nice reduces the priority of any process.

2. Which option can be used explicitly to reduce the priority of any process.
a) -a
b) -n
c) -o
d) -q

Answer: b
Clarification: nice values are system-dependent and typically range from 1 to 19. We can also specify the nice value explicitly with the -n option but a non-privileged user cannot increase the priority of a process. For example, to increase the priority by 8 times use the following command:

$ nice  -n  5  wc  -l emp.lst &

3. Which command is used for premature termination of a process?
a) signal
b) nice
c) kill
d) nohup

Answer: c
Clarification: The kill command is used for premature termination of a process. It usually sends a signal with the intention of killing one or more processes. kill is an internal command in most shells. Kill command uses one or more PID’s as its arguments. For example,

$ kill 105        // terminates the job having PID 105

4. Which one of the following command is used for killing the last background job?
a) kill $
b) kill $$
c) kill $!
d) kill !

Answer: c
Clarification: For most shells, the system variable $! Stores the PID of the last background job. So we can kill any process by using kill command. The PID of the job can be seen when & is affixed to a command. For example,

$ sort  -o  emp.lst &        
467
$ kill $!             // kills the sort command

5. By default, kill uses the SIGTERM signal (15) to terminate the process.
a) True
b) False

Answer: a
Clarification: UNIX often requires to communicate the occurrence of events to process. This is done by sending a signal. The SIGTERM signal (15) is the default signal used by the kill command to terminate processes.

6. Which signal is used with kill command to terminate the process when they ignore the SIGTERM signal (15)?
a) SIGTERM (16)
b) SIGTERM(0)
c) SIGKILL(9)
d) -d

Answer: c
Clarification: By default, the SIGTERM signal (15) is used by the kill command to terminate processes. But sometimes it may happen that some programs ignore it and continue their execution normally. In such a case, the process can be killed by using SIGKILL signal (9). For example, to kill a job with PID 134 use the following command:

7. Which option is preferred while killing a process using SIGKILL signal (9)?
a) -p
b) -s
c) -h
d) -d

Answer: b
Clarification: Sometimes it may happen that some programs ignore the SIGTERM signal (15) and continue their execution normally. In such a case, the process can be killed by using SIGKILL signal (9). This signal can’t be generated at the press of a key, so we have to use KILL with the signal name preceded with -s option. For example, to kill a job with PID 184 use the following command:

8. Which of the followings command(s) is used to kill the login shell?
a) kill 0
b) kill -9 $$
c) kill -s KILL 0
d) kill -9 $$ and kill -s KILL 0

Answer: d
Clarification: A simple kill command (with TERM) will not kill the login shell. We can kill the login shell by using any of the following commands:

$ kill  -9  $$               // $$ stores the PID of current shell
$ kill  -s  KILL 0          // kills all processes including the login shell

9. Kill -l will list all the signal numbers on our machine.
a) True
b) False
View Answer

Answer: a
Clarification: To view the list of all signal names and numbers that are available on our machine, we have to use the -l option with kill command or view the file /usr/include/sys/signal.h

Leave a Reply

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