UNIX MCQs – Process Basics (Part – 1)

UNIX Question and Answer – UNIX Process Basics

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

1. What is the primary function of a process in UNIX?

a) Manage system resources

b) Handle file system operations

c) Execute user commands

d) Monitor network connections

Answer: c) Execute user commands

Explanation: Processes in UNIX are responsible for executing user commands and programs.


2. What does the process lifecycle in UNIX typically include?

a) Initialization, execution, and termination

b) Execution, suspension, and resumption

c) Initialization, scheduling, and termination

d) Scheduling, execution, and suspension

Answer: a) Initialization, execution, and termination

Explanation: The process lifecycle in UNIX involves initialization when the process is created, execution of its code, and termination when it completes its task.


3. Which UNIX system call is used to create a new process?

a) create()

b) fork()

c) newproc()

d) spawn()

Answer: b) fork()

Explanation: The fork() system call is used to create a new process by duplicating the existing one.


4. What is the state of a process that is waiting for a specific event to occur?

a) Running

b) Sleeping

c) Zombie

d) Stopped

Answer: b) Sleeping

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


5. When does a process become a zombie in UNIX?

a) When it is waiting for a signal

b) When it is terminated but its parent has not yet acknowledged its termination

c) When it is waiting for CPU allocation

d) When it is waiting for user input

Answer: b) When it is terminated but its parent has not yet acknowledged its termination

Explanation: A zombie process is one that has completed execution but still has an entry in the process table because its parent process has not yet received its termination status.


6. Which command is used to display the status of processes in UNIX?

a) ps

b) top

c) status

d) process

Answer: a) ps

Explanation: The ps command is used to display the status of processes in UNIX, including their IDs, states, and resource usage.


7. What is the state of a process that is currently using the CPU?

a) Running

b) Ready

c) Sleeping

d) Zombie

Answer: a) Running

Explanation: A process in the running state is currently using the CPU for execution.


8. 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.


9. Which UNIX command is used to send signals to processes?

a) sigsend

b) kill

c) signal

d) sigaction

Answer: b) kill

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


10. What is the process state of a newly created process that has not yet been scheduled for execution?

a) Ready

b) Running

c) Sleeping

d) Zombie

Answer: a) Ready

Explanation: A newly created process that is waiting to be scheduled for execution is in the ready state.


11. In UNIX, what is the role of the scheduler in managing processes?

a) Allocating memory resources

b) Allocating CPU resources

c) Managing file system operations

d) Managing network connections

Answer: b) Allocating CPU resources

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


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

a) It has completed execution

b) It is waiting for a specific event to occur

c) It has been temporarily suspended by a signal

d) It is waiting for user input

Answer: c) It has been temporarily suspended by a signal

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


13. Which UNIX system call is used to terminate a process?

a) kill()

b) exit()

c) terminate()

d) stop()

Answer: b) exit()

Explanation: The exit() system call is used to terminate a process in UNIX, allowing it to clean up resources before termination.


14. What is the state of a process that has completed execution but is still waiting for its parent to acknowledge its termination?

a) Running

b) Ready

c) Zombie

d) Sleeping

Answer: c) Zombie

Explanation: A zombie process has completed execution but is still waiting for its parent to acknowledge its termination.


15. 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.


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

a) Create new processes

b) Terminate processes

c) Manage system initialization and process management

d) Execute user commands

Answer: c) Manage system initialization and process management

Explanation: The init process in UNIX is the first process started during boot and is responsible for system initialization and process management.


17. Which command is used to display information about process resources in UNIX?

a) procinfo

b) pstat

c) prstat

d) ps

Answer: d) ps

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


18. 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.


19. Which system call is used to suspend the execution of a process in UNIX?

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.


20. What does the “defunct” state of a process signify in UNIX?

a) It is waiting for user input

b) It has been terminated but its parent has not yet acknowledged its termination

c) It is waiting for a specific event to occur

d) It is waiting for CPU allocation

Answer: b) It has been terminated but its parent has not yet acknowledged its termination

Explanation: A process in the “defunct” state has completed execution but its parent process has not yet acknowledged its termination.


21. 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.


22. What is the primary 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.


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

a) signal

b) sigsend

c) kill

d) send

Answer: c) kill

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


24. 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 in UNIX is used to replace the current process with a new program, loading the new program into memory and executing it.


25. 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.


26. What is the primary role of the init process in UNIX?

a) Manage file system operations

b) Execute user commands

c) Manage system initialization and process management

d) Provide CPU resources to child processes

Answer: c) Manage system initialization and process management

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


27. Which system call is used to create a new process in UNIX?

a) spawn()

b) fork()

c) create()

d) exec()

Answer: b) fork()

Explanation: The fork() system call is used to create a new process by duplicating the existing one.


28. 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.


29. 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.


30. What does the “defunct” state of a process signify in UNIX?

a) It is waiting for CPU allocation

b) It is waiting for user input

c) It has been terminated but its parent has not yet acknowledged its termination

d) It is waiting for a specific event to occur

Answer: c) It has been terminated but its parent has not yet acknowledged its termination

Explanation: A process in the “defunct” state has completed execution but its parent process has not yet acknowledged its termination.


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

a) sigsend

b) signal

c) kill

d) send

Answer: c) kill

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


32. What is the role of the nice command in UNIX?

a) Terminate a process

b) Change the priority of a running process

c) Suspend the execution of a process

d) Send a signal to a process

Answer: b) Change the priority of a running process

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


33. What is the primary function 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 is used to suspend the execution of a parent process until one of its child processes terminates.


34. Which command is used to view information about CPU and memory usage in UNIX?

a) cpuinfo

b) meminfo

c) sysinfo

d) top

Answer: d) top

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


35. What is the state of a process that is currently using the CPU for execution?

a) Ready

b) Running

c) Sleeping

d) Stopped

Answer: b) Running

Explanation: A process in the running state is currently using the CPU for execution.


36. Which system call is used to terminate a process in UNIX?

a) exit()

b) kill()

c) stop()

d) terminate()

Answer: a) exit()

Explanation: The exit() system call is used to terminate a process in UNIX, allowing it to clean up resources before termination.


37. What does the “zombie” state of a process signify in UNIX?

a) It is waiting for user input

b) It has been terminated but its parent has not yet acknowledged its termination

c) It is waiting for a specific event to occur

d) It is waiting for CPU allocation

Answer: b) It has been terminated but its parent has not yet acknowledged its termination

Explanation: A process in the “zombie” state has completed execution but its parent process has not yet acknowledged its termination.


38. Which command is used to change the priority of a 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 process in UNIX.


39. 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.


40. 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.


41. 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.


42. What is the state of a process that is waiting for a specific event to occur, such as I/O completion?

a) Running

b) Ready

c) Sleeping

d) Stopped

Answer: c) Sleeping

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


43. 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.


44. 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.


45. 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.


46. What is the purpose of the killall command in UNIX?

a) Terminate all processes on the system

b) Send a signal to a specific process

c) Kill all processes with a specific name

d) Send a signal to all processes on the system

Answer: c) Kill all processes with a specific name

Explanation: The killall command is used to terminate all processes with a specific name in UNIX.


47. 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.


48. 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.


49. 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.


50. 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.

Related Articles

Linux MCQ

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