UNIX MCQs – Process Basics (Part – 2)

UNIX Question and Answer – UNIX Process Basics

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

1. What does the “sleeping” state of a process signify in UNIX?

a) The process is waiting for user input

b) The process is waiting for a specific event to occur

c) The process has completed execution

d) The process is currently using the CPU

Answer: b) The process is waiting for a specific event to occur

Explanation: A process in the sleeping state is waiting for a specific event, such as I/O completion, before it can proceed.


2. Which system call is used to suspend the execution of a process until it receives a signal?

a) stop()

b) suspend()

c) pause()

d) sleep()

Answer: c) pause()

Explanation: The pause() system call is used to suspend the execution of a process until it receives a signal.


3. What is the purpose of the getpid() system call in UNIX?

a) Retrieve the process ID of the parent process

b) Retrieve the process ID of the current process

c) Retrieve the process ID of a specific process

d) Retrieve the process ID of the child process

Answer: b) Retrieve the process ID of the current process

Explanation: The getpid() system call is used to retrieve the process ID (PID) of the current process in UNIX.


4. Which command is used to display information about system processes in UNIX?

a) ps

b) top

c) pstree

d) process

Answer: a) ps

Explanation: The ps command is used to display information about system processes, including their IDs, states, and resource usage, in UNIX.


5. What does the “stopped” state of a process indicate in UNIX?

a) The process has completed execution

b) The process is waiting for a specific event to occur

c) The process has been temporarily suspended by a signal

d) The process is waiting for user input

Answer: c) The process has been temporarily suspended by a signal

Explanation: A process in the stopped state has been temporarily suspended by a signal, such as SIGSTOP.


6. Which command is used to change the priority of a running process in UNIX?

a) nice

b) priority

c) renice

d) change

Answer: c) renice

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


7. What is the purpose of the exec() system call in UNIX?

a) Create a new process

b) Replace the current process with a new program

c) Send a signal to a process

d) Suspend the execution of a process

Answer: b) Replace the current process with a new program

Explanation: The exec() system call is used to replace the current process with a new program in UNIX.


8. What is the state of a process that has completed execution but its termination status has not yet been acknowledged by its parent?

a) Running

b) Ready

c) Zombie

d) Stopped

Answer: c) Zombie

Explanation: A zombie process has completed execution but its termination status has not yet been acknowledged by its parent.


9. Which command is used to view a tree of processes in UNIX?

a) ps

b) pstree

c) top

d) process

Answer: b) pstree

Explanation: The pstree command is used to display a tree of processes in UNIX, showing their hierarchical relationship.


10. What is the purpose of the kill command in UNIX?

a) Terminate a process

b) Send a signal to a process

c) Suspend a process

d) Resume a process

Answer: b) Send a signal to a process

Explanation: The kill command is used to send signals to processes in UNIX, allowing for various actions such as termination or interruption.


11. Which system call is used to terminate the current process in UNIX?

a) stop()

b) exit()

c) terminate()

d) kill()

Answer: b) exit()

Explanation: The exit() system call is used to terminate the current process in UNIX.


12. What is the role of the scheduler in UNIX process management?

a) Allocate memory resources to processes

b) Allocate CPU resources to processes

c) Manage file system operations

d) Manage network connections

Answer: b) Allocate CPU resources to processes

Explanation: The scheduler in UNIX is responsible for allocating CPU resources to processes based on their priority and scheduling algorithm.


13. Which command is used to display a list of signals in UNIX?

a) siglist

b) signal

c) kill -l

d) siginfo

Answer: c) kill -l

Explanation: The kill -l command is used to display a list of signals in UNIX.


14. What does the “ready” state of a process signify in UNIX?

a) It is waiting for user input

b) It is waiting for a specific event to occur

c) It is waiting to be assigned CPU time

d) It has completed execution

Answer: c) It is waiting to be assigned CPU time

Explanation: A process in the ready state is prepared to execute and is waiting to be assigned CPU time by the scheduler.


15. Which system call is used to suspend the execution of a process until a specified amount of time has elapsed?

a) sleep()

b) pause()

c) wait()

d) alarm()

Answer: d) alarm()

Explanation: The alarm() system call is used to suspend the execution of a process until a specified amount of time has elapsed or until a signal occurs.


16. What is the role of the parent process in UNIX?

a) Provide CPU resources to child processes

b) Terminate child processes

c) Communicate with child processes and manage their execution

d) Execute user commands

Answer: c) Communicate with child processes and manage their execution

Explanation: The parent process in UNIX communicates with its child processes, manages their execution, and receives their termination status.


17. Which command is used to display real-time information about CPU and memory usage in UNIX?

a) meminfo

b) top

c) sysinfo

d) ps

Answer: b) top

Explanation: The top command is used to display real-time information about CPU and memory usage in UNIX.


18. What is the state of a process that is waiting for user input?

a) Running

b) Ready

c) Sleeping

d) Stopped

Answer: c) Sleeping

Explanation: A process in the sleeping state is waiting for user input or a specific event to occur.


19. Which command is used to change the priority of a process in UNIX?

a) renice

b) nice

c) prio

d) priority

Answer: a) renice

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


20. What is the purpose of the wait() system call in UNIX?

a) Suspend the calling process until a child process terminates

b) Terminate the calling process

c) Execute a new process

d) Send a signal to another process

Answer: a) Suspend the calling process until a child process terminates

Explanation: The wait() system call in UNIX is used by a parent process to suspend its execution until one of its child processes terminates.


21. Which command is used to display information about running processes in UNIX?

a) ps

b) top

c) pstree

d) process

Answer: a) ps

Explanation: The ps command is used to display information about running processes, including their IDs, states, and resource usage, in UNIX.


22. What is the purpose of the getpid() system call in UNIX?

a) Retrieve the process ID of the parent process

b) Retrieve the process ID of the current process

c) Retrieve the process ID of a specific process

d) Retrieve the process ID of the child process

Answer: b) Retrieve the process ID of the current process

Explanation: The getpid() system call is used to retrieve the process ID (PID) of the current process in UNIX.


23. Which command is used to display a hierarchical tree of processes in UNIX?

a) ps -t

b) pstree

c) top -t

d) tree

Answer: b) pstree

Explanation: The pstree command is used to display a hierarchical tree of processes in UNIX, showing their parent-child relationships.


24. What is the state of a process that has been suspended and can be resumed at a later time?

a) Stopped

b) Ready

c) Running

d) Sleeping

Answer: a) Stopped

Explanation: A process in the stopped state has been temporarily suspended and can be resumed at a later time.


25. Which system call is used to suspend the execution of a process until it receives a signal?

a) stop()

b) suspend()

c) pause()

d) sleep()

Answer: c) pause()

Explanation: The pause() system call is used to suspend the execution of a process until it receives a signal.


26. Which system call is used to terminate a specific process identified by its process ID (PID) in UNIX?

a) kill()

b) exit()

c) stop()

d) terminate()

Answer: a) kill()

Explanation: The kill() system call is used to send signals to processes in UNIX, allowing for various actions such as termination or interruption.


27. What is the state of a process that has completed execution and has been removed from the process table?

a) Running

b) Ready

c) Zombie

d) Defunct

Answer: d) Defunct

Explanation: A process in the defunct state has completed execution and has been removed from the process table but its parent has not yet acknowledged its termination.


28. Which command is used to display detailed information about a specific process identified by its PID in UNIX?

a) ps -l

b) top -p

c) pinfo

d) procinfo

Answer: b) top -p

Explanation: The top command with the -p option is used to display detailed information about a specific process identified by its PID in UNIX.


29. What is the primary function of the nice command in UNIX?

a) Create a new process

b) Terminate a process

c) Change the priority of a process

d) Suspend a process

Answer: c) Change the priority of a process

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


30. What is the role of the init process in UNIX?

a) Manage system initialization and process management

b) Execute user commands

c) Provide CPU resources to child processes

d) Terminate child processes

Answer: a) Manage system initialization and process management

Explanation: The init process in UNIX is responsible for system initialization and managing the process lifecycle.


31. Which command is used to send a specific signal to a process in UNIX?

a) kill -SIGNAL

b) signal

c) sigsend

d) send

Answer: a) kill -SIGNAL

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


32. What is the purpose of the waitpid() system call in UNIX?

a) Suspend the calling process until a child process terminates

b) Terminate the calling process

c) Execute a new process

d) Send a signal to another process

Answer: a) Suspend the calling process until a child process terminates

Explanation: The waitpid() system call in UNIX is used to suspend the execution of the calling process until a specific child process terminates.


33. What is the state of a process that is waiting for a resource such as a file or input/output operation to become available?

a) Ready

b) Running

c) Sleeping

d) Blocked

Answer: d) Blocked

Explanation: A process in the blocked state is waiting for a resource such as a file or input/output operation to become available before it can proceed.


34. Which command is used to change the priority of a process in UNIX?

a) renice

b) nice

c) prio

d) priority

Answer: a) renice

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


35. What is the role of the wait() system call in UNIX?

a) Suspend the calling process until a child process terminates

b) Terminate the calling process

c) Execute a new process

d) Send a signal to another process

Answer: a) Suspend the calling process until a child process terminates

Explanation: The wait() system call in UNIX is used by a parent process to suspend its execution until one of its child processes terminates.


36. Which command is used to display information about system processes in UNIX, including the processes from all users?

a) ps -e

b) ps -a

c) ps -aux

d) ps -all

Answer: c) ps -aux

Explanation: The ps -aux command is used to display information about system processes in UNIX, including the processes from all users.


37. What is the state of a process that has been suspended and can be resumed at a later time?

a) Stopped

b) Ready

c) Running

d) Sleeping

Answer: a) Stopped

Explanation: A process in the stopped state has been temporarily suspended and can be resumed at a later time.


38. Which system call is used to suspend the execution of a process until a specified amount of time has elapsed or a signal occurs?

a) sleep()

b) pause()

c) alarm()

d) wait()

Answer: c) alarm()

Explanation: The alarm() system call is used to suspend the execution of a process until a specified amount of time has elapsed or until a signal occurs.


39. What is the role of the parent process in UNIX?

a) Provide CPU resources to child processes

b) Terminate child processes

c) Communicate with child processes and manage their execution

d) Execute user commands

Answer: c) Communicate with child processes and manage their execution

Explanation: The parent process in UNIX communicates with its child processes, manages their execution, and receives their termination status.


40. Which command is used to display real-time information about CPU and memory usage in UNIX?

a) meminfo

b) top

c) sysinfo

d) ps

Answer: b) top

Explanation: The top command is used to display real-time information about CPU and memory usage in UNIX.


41. What is the state of a process that is waiting for user input or a specific event to occur?

a) Running

b) Ready

c) Sleeping

d) Blocked

Answer: c) Sleeping

Explanation: A process in the sleeping state is waiting for user input or a specific event to occur.


42. Which command is used to display a list of signals in UNIX?

a) siglist

b) signal

c) kill -l

d) siginfo

Answer: c) kill -l

Explanation: The kill -l command is used to display a list of signals in UNIX.


43. What is the state of a process that is waiting for a resource such as a file or input/output operation to become available?

a) Ready

b) Running

c) Sleeping

d) Blocked

Answer: d) Blocked

Explanation: A process in the blocked state is waiting for a resource such as a file or input/output operation to become available before it can proceed.


44. Which system call is used to suspend the execution of a process until it receives a signal?

a) stop()

b) suspend()

c) pause()

d) sleep()

Answer: c) pause()

Explanation: The pause() system call is used to suspend the execution of a process until it receives a signal.


45. What is the purpose of the exec() system call in UNIX?

a) Create a new process

b) Replace the current process with a new program

c) Send a signal to a process

d) Suspend the execution of a process

Answer: b) Replace the current process with a new program

Explanation: The exec() system call is used to replace the current process with a new program in UNIX.


46. What is the role of the scheduler in UNIX process management?

a) Allocate memory resources to processes

b) Allocate CPU resources to processes

c) Manage file system operations

d) Manage network connections

Answer: b) Allocate CPU resources to processes

Explanation: The scheduler in UNIX is responsible for allocating CPU resources to processes based on their priority and scheduling algorithm.


47. Which command is used to display detailed information about a specific process identified by its PID in UNIX?

a) ps -l

b) top -p

c) pinfo

d) procinfo

Answer: b) top -p

Explanation: The top command with the -p option is used to display detailed information about a specific process identified by its PID in UNIX.


48. What is the state of a process that has been terminated but its parent has not yet acknowledged its termination?

a) Running

b) Ready

c) Zombie

d) Stopped

Answer: c) Zombie

Explanation: A zombie process has been terminated but its parent has not yet acknowledged its termination.


49. Which command is used to send a specific signal to a process in UNIX?

a) kill -SIGNAL

b) signal

c) sigsend

d) send

Answer: a) kill -SIGNAL

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


50. What is the purpose of the getpid() system call in UNIX?

a) Retrieve the process ID of the parent process

b) Retrieve the process ID of the current process

c) Retrieve the process ID of a specific process

d) Retrieve the process ID of the child process

Answer: b) Retrieve the process ID of the current process

Explanation: The getpid() system call is used to retrieve the process ID (PID) of the current process in UNIX.

Related Articles

Linux MCQ

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