UNIX MCQs – Background and Foreground Processes (Part -3)

UNIX Question and Answer – Background and Foreground Processes

UNIX MCQ – Multiple Choice Questions for exam, interview, and Entrance Test

1. What command is used to move a background process to the foreground in UNIX?

a) fg

b) bg

c) move

d) switch

Answer: a) fg

Explanation: The fg command is used to move a background process to the foreground in UNIX.


2. In UNIX, which signal is sent to a process when it receives the Ctrl+Z key combination?

a) SIGINT

b) SIGTSTP

c) SIGSTOP

d) SIGHUP

Answer: b) SIGTSTP

Explanation: SIGTSTP is sent to a process when it receives the Ctrl+Z key combination, suspending it in UNIX.


3. What is the purpose of the disown command in UNIX?

a) Suspend a process

b) Terminate a process

c) Remove a process from the shell’s job table

d) Bring a process to the foreground

Answer: c) Remove a process from the shell’s job table

Explanation: The disown command is used to remove a process from the shell’s job table in UNIX.


4. In UNIX, what happens to a background process when the shell session ends?

a) It is terminated

b) It is paused

c) It is resumed

d) It is moved to the foreground

Answer: a) It is terminated

Explanation: Background processes are terminated when the shell session ends in UNIX.


5. Which command is used to send a signal to resume a suspended background process in UNIX?

a) fg

b) kill -CONT

c) resume

d) unstop

Answer: b) kill -CONT

Explanation: The kill command with the -CONT option is used to send a signal to resume a suspended background process in UNIX.


6. In UNIX, what is the purpose of the nice command?

a) Change the ownership of a process

b) Change the priority of a process

c) Change the group of a process

d) Change the name of a process

Answer: b) Change the priority of a process

Explanation: The nice command is used to change the priority of a process in UNIX.


7. What signal is sent to a process when the Ctrl+D key combination is pressed in UNIX?

a) SIGINT

b) SIGTSTP

c) SIGQUIT

d) SIGHUP

Answer: d) SIGHUP

Explanation: SIGHUP is sent to a process when the Ctrl+D key combination is pressed in UNIX.


8. What is the primary purpose of the bg command in UNIX?

a) Move a background process to the foreground

b) Move a foreground process to the background

c) Terminate a background process

d) Display a list of background jobs

Answer: b) Move a foreground process to the background

Explanation: The bg command is used to move a suspended foreground process to the background in UNIX.


9. In UNIX, what happens to a foreground process when it receives the SIGTERM signal?

a) It is suspended

b) It is resumed

c) It is terminated

d) It is sent to the background

Answer: c) It is terminated

Explanation: A foreground process is terminated when it receives the SIGTERM signal in UNIX.


10. Which command is used to send a signal to a process by its name in UNIX?

a) pskill

b) pkill

c) killbyname

d) signalbyname

Answer: b) pkill

Explanation: The pkill command is used to send a signal to a process by its name in UNIX.


11. In UNIX, what is the primary purpose of the killall command?

a) Terminate a process by name

b) Terminate all running processes

c) Bring all processes to the foreground

d) Suspend all running processes

Answer: a) Terminate a process by name

Explanation: The killall command is used to terminate a process by name in UNIX.


12. What signal is sent to a process when the Ctrl+C key combination is pressed in UNIX?

a) SIGINT

b) SIGTERM

c) SIGQUIT

d) SIGHUP

Answer: a) SIGINT

Explanation: SIGINT is sent to a process when the Ctrl+C key combination is pressed in UNIX.


13. In UNIX, what is the purpose of the renice command?

a) Change the name of a process

b) Change the priority of a process

c) Change the owner of a process

d) Change the group of a process

Answer: b) Change the priority of a process

Explanation: The renice command is used to change the priority of a process in UNIX.


14. What signal is sent to a process when the Ctrl+D key combination is pressed in UNIX?

a) SIGKILL

b) SIGTERM

c) SIGHUP

d) SIGQUIT

Answer: c) SIGHUP

Explanation: SIGHUP is sent to a process when the Ctrl+D key combination is pressed in UNIX.


15. In UNIX, what is the primary purpose of the trap command?

a) Run a command in the background

b) Handle signals received by the shell or scripts

c) Display system load information

d) Manage user sessions

Answer: b) Handle signals received by the shell or scripts

Explanation: The trap command is used to handle signals received by the shell or scripts in UNIX.


16. What is the purpose of the wait command in UNIX?

a) Suspend a process until it receives a signal

b) Terminate a process

c) Bring a process to the foreground

d) Wait for background processes to complete

Answer: d) Wait for background processes to complete

Explanation: The wait command is used to wait for background processes to complete in UNIX.


17. Which command is used to send a signal to stop a process in UNIX?

a) stop

b) kill -STOP

c) suspend

d) pause

Answer: b) kill -STOP

Explanation: The kill command with the -STOP option is used to send a signal to stop a process in UNIX.


18. In UNIX, what is the purpose of the renice command?

a) Change the name of a process

b) Change the priority of a process

c) Change the owner of a process

d) Change the group of a process

Answer: b) Change the priority of a process

Explanation: The renice command is used to change the priority of a process in UNIX.


19. What signal is sent to a process when the Ctrl+D key combination is pressed?

a) SIGKILL

b) SIGTERM

c) SIGHUP

d) SIGQUIT

Answer: c) SIGHUP

Explanation: SIGHUP is the signal sent to a process when the Ctrl+D key combination is pressed in UNIX.


20. What is the purpose of the trap command in UNIX?

a) Run a command in the background

b) Handle signals received by the shell or scripts

c) Display system load information

d) Manage user sessions

Answer: b) Handle signals received by the shell or scripts

Explanation: The trap command is used to handle signals received by the shell or scripts in UNIX.


21. In UNIX, what is the significance of the & symbol when used with a command?

a) It redirects output to a file

b) It runs the command as a background process

c) It runs the command as a foreground process

d) It pipes output to another command

Answer: b) It runs the command as a background process

Explanation: The & symbol is used to run a command as a background process in UNIX.


22. What is the purpose of the wait command in UNIX?

a) Suspend a process until it receives a signal

b) Terminate a process

c) Bring a process to the foreground

d) Wait for background processes to complete

Answer: d) Wait for background processes to complete

Explanation: The wait command is used to wait for background processes to complete in UNIX.


23. Which command is used to send a signal to stop a process in UNIX?

a) stop

b) kill -STOP

c) suspend

d) pause

Answer: b) kill -STOP

Explanation: The kill command with the -STOP option is used to send a signal to stop a process in UNIX.


24. In UNIX, what is the purpose of the renice command?

a) Change the name of a process

b) Change the priority of a process

c) Change the owner of a process

d) Change the group of a process

Answer: b) Change the priority of a process

Explanation: The renice command is used to change the priority of a process in UNIX.


25. What signal is sent to a process when the Ctrl+D key combination is pressed?

a) SIGKILL

b) SIGTERM

c) SIGHUP

d) SIGQUIT

Answer: c) SIGHUP

Explanation: SIGHUP is the signal sent to a process when the Ctrl+D key combination is pressed in UNIX.


26. Which command is used to display the process ID (PID) of a running process in UNIX?

a) pid

b) pidof

c) psid

d) getpid

Answer: b) pidof

Explanation: The pidof command is used to display the process ID (PID) of a running process in UNIX.


27. In UNIX, what happens to a background process when the shell session is suspended using Ctrl+Z?

a) It continues running in the background

b) It is paused and moved to the foreground

c) It is terminated

d) It is resumed automatically

Answer: b) It is paused and moved to the foreground

Explanation: When the shell session is suspended using Ctrl+Z, the background process is paused and moved to the foreground in UNIX.


28. What is the purpose of the kill command with the -9 option in UNIX?

a) Pause a process

b) Terminate a process immediately

c) Send a stop signal to a process

d) Change the priority of a process

Answer: b) Terminate a process immediately

Explanation: The kill command with the -9 option is used to terminate a process immediately in UNIX.


29. In UNIX, what does the term “foreground” refer to in the context of processes?

a) Processes that are running in the background

b) Processes that are running in the terminal and are interactive

c) Processes that are paused

d) Processes that are running with elevated privileges

Answer: b) Processes that are running in the terminal and are interactive

Explanation: In UNIX, foreground processes refer to processes that are running in the terminal and are interactive.


30. Which command is used to send a signal to a process by its name in UNIX?

a) signal

b) killall

c) pkill

d) psignal

Answer: c) pkill

Explanation: The pkill command is used to send a signal to a process by its name in UNIX.


31. In UNIX, what is the purpose of the renice command?

a) Change the name of a process

b) Change the priority of a process

c) Change the owner of a process

d) Change the group of a process

Answer: b) Change the priority of a process

Explanation: The renice command is used to change the priority of a process in UNIX.


32. What signal is sent to a process when the Ctrl+C key combination is pressed in UNIX?

a) SIGKILL

b) SIGTERM

c) SIGHUP

d) SIGINT

Answer: d) SIGINT

Explanation: SIGINT is sent to a process when the Ctrl+C key combination is pressed in UNIX.


33. What is the purpose of the nohup command in UNIX?

a) Run a command in the background and ignore hangup signals

b) Run a command with elevated privileges

c) Run a command in the foreground

d) Run a command without any output

Answer: a) Run a command in the background and ignore hangup signals

Explanation: The nohup command is used to run a command in the background and ignore hangup signals in UNIX.


34. In UNIX, what does the term “background” refer to in the context of processes?

a) Processes that are running in the terminal and are interactive

b) Processes that are paused

c) Processes that are running with elevated privileges

d) Processes that are running independently of the terminal

Answer: d) Processes that are running independently of the terminal

Explanation: In UNIX, background processes refer to processes that are running independently of the terminal.


35. Which command is used to send a signal to a process by its process ID (PID) in UNIX?

a) kill

b) signal

c) psignal

d) killall

Answer: a) kill

Explanation: The kill command is used to send a signal to a process by its process ID (PID) in UNIX.


36. In UNIX, what is the purpose of the bg command?

a) Bring a background process to the foreground

b) Move a suspended process to the background

c) Terminate a background process

d) Suspend a foreground process

Answer: b) Move a suspended process to the background

Explanation: The bg command is used to move a suspended process to the background in UNIX.


37. What signal is sent to a process when the Ctrl+D key combination is pressed in UNIX?

a) SIGINT

b) SIGTSTP

c) SIGHUP

d) SIGQUIT

Answer: c) SIGHUP

Explanation: SIGHUP is sent to a process when the Ctrl+D key combination is pressed in UNIX.


38. In UNIX, what is the purpose of the fg command?

a) Move a process to the foreground

b) Move a process to the background

c) Terminate a process

d) Display a list of background jobs

Answer: a) Move a process to the foreground

Explanation: The fg command is used to move a process to the foreground in UNIX.


39. What is the significance of the $! symbol in UNIX shell scripting?

a) It represents the process ID (PID) of the last background command

b) It represents the process ID (PID) of the last foreground command

c) It represents the exit status of the last command

d) It represents the number of arguments passed to a command

Answer: a) It represents the process ID (PID) of the last background command

Explanation: The $! symbol represents the process ID (PID) of the last background command in UNIX shell scripting.


40. Which command is used to send a signal to a process by its name in UNIX?

a) psignal

b) signal

c) pkill

d) killall

Answer: c) pkill

Explanation: The pkill command is used to send a signal to a process by its name in UNIX.


41. In UNIX, what does the term “foreground” refer to in the context of processes?

a) Processes that are running in the background

b) Processes that are running in the terminal and are interactive

c) Processes that are paused

d) Processes that are running with elevated privileges

Answer: b) Processes that are running in the terminal and are interactive

Explanation: In UNIX, foreground processes refer to processes that are running in the terminal and are interactive.


42. Which command is used to display the process ID (PID) of a running process in UNIX?

a) pid

b) pidof

c) psid

d) getpid

Answer: b) pidof

Explanation: The pidof command is used to display the process ID (PID) of a running process in UNIX.


43. In UNIX, what happens to a background process when the shell session is suspended using Ctrl+Z?

a) It continues running in the background

b) It is paused and moved to the foreground

c) It is terminated

d) It is resumed automatically

Answer: b) It is paused and moved to the foreground

Explanation: When the shell session is suspended using Ctrl+Z, the background process is paused and moved to the foreground in UNIX.


44. What is the purpose of the kill command with the -9 option in UNIX?

a) Pause a process

b) Terminate a process immediately

c) Send a stop signal to a process

d) Change the priority of a process

Answer: b) Terminate a process immediately

Explanation: The kill command with the -9 option is used to terminate a process immediately in UNIX.


45. In UNIX, what does the term “background” refer to in the context of processes?

a) Processes that are running in the terminal and are interactive

b) Processes that are paused

c) Processes that are running with elevated privileges

d) Processes that are running independently of the terminal

Answer: d) Processes that are running independently of the terminal

Explanation: In UNIX, background processes refer to processes that are running independently of the terminal.


46. Which command is used to send a signal to a process by its name in UNIX?

a) signal

b) killall

c) pkill

d) psignal

Answer: c) pkill

Explanation: The pkill command is used to send a signal to a process by its name in UNIX.


47. In UNIX, what is the purpose of the renice command?

a) Change the name of a process

b) Change the priority of a process

c) Change the owner of a process

d) Change the group of a process

Answer: b) Change the priority of a process

Explanation: The renice command is used to change the priority of a process in UNIX.


48. What signal is sent to a process when the Ctrl+C key combination is pressed in UNIX?

a) SIGKILL

b) SIGTERM

c) SIGHUP

d) SIGINT

Answer: d) SIGINT

Explanation: SIGINT is sent to a process when the Ctrl+C key combination is pressed in UNIX.


49. What is the purpose of the nohup command in UNIX?

a) Run a command in the background and ignore hangup signals

b) Run a command with elevated privileges

c) Run a command in the foreground

d) Run a command without any output

Answer: a) Run a command in the background and ignore hangup signals

Explanation: The nohup command is used to run a command in the background and ignore hangup signals in UNIX.


50. In UNIX, what does the term “foreground” refer to in the context of processes?

a) Processes that are running in the background

b) Processes that are running in the terminal and are interactive

c) Processes that are paused

d) Processes that are running with elevated privileges

Answer: b) Processes that are running in the terminal and are interactive

Explanation: In UNIX, foreground processes refer to processes that are running in the terminal and are interactive.

Related Articles

Linux MCQ

Welcome to Linux Multiple Choice Questions (MCQ) Section Embark on a journey through the world of...