Skip to main content

Operating System MCQs with Answers

Practice important Operating System MCQs with answers and explanations.

Chapter: 6
Q161:
What happens when a process exceeds its allocated resources in UNIX/Linux?
A. Parent terminates the child
B. The operating system will automatically terminate the process
C. The parent waits for the process to finish
D. Child process self-terminates
Correct Answer: B
Chapter: 6
Q162:
Fill in the blank: The fork() system call allows a process to create a _______ process.
A. Child
B. Parent
C. Helper
D. Background
Correct Answer: A
Chapter: 6
Q163:
Fill in the blank: The execlp system call in UNIX is used to load a _______ into the child’s memory.
A. Binary file
B. Program code
C. Script
D. File descriptor
Correct Answer: A
Chapter: 7
Q164:
What does the wait() system call do in Unix/Linux?
A. Suspends the calling process
B. Terminates the calling process
C. Changes the process ID
D. Starts a new process
Correct Answer: A
Chapter: 7
Q165:
Which system call is used to replace the process memory space in Unix/Linux?
A. execlp()
B. fork()
C. wait()
D. exit()
Correct Answer: A
Chapter: 7
Q166:
What happens if all child processes have terminated before calling wait()?
A. The parent process will wait indefinitely
B. The parent process will terminate
C. The parent process will return immediately
D. The parent process will hang forever
Correct Answer: C
Chapter: 7
Q167:
In the sample code shown, what function is used to check if the fork() system call fails?
A. perror()
B. exit()
C. wait()
D. printf()
Correct Answer: B
Chapter: 7
Q168:
What is the typical use of the execlp() system call?
A. To create a new process
B. To terminate a process
C. To replace the process memory
D. To suspend the process
Correct Answer: C
Chapter: 7
Q169:
The producer-consumer problem requires a __________ to store produced items.
A. queue
B. stack
C. buffer
D. tree
Correct Answer: C
Chapter: 7
Q170:
In the producer-consumer problem, what condition indicates that the buffer is full?
A. in == out
B. (in + 1) % BUFFER_SIZE == out
C. in > out
D. in > BUFFER_SIZE
Correct Answer: B
Chapter: 7
Q171:
Which system call suspends the calling process until a child terminates?
A. wait()
B. exec()
C. fork()
D. exit()
Correct Answer: A
Chapter: 7
Q172:
What does the function execlp() replace in a process?
A. The process memory space
B. The process ID
C. The process parent
D. The process stack
Correct Answer: A
Chapter: 7
Q173:
What is the result of a successful execlp() system call?
A. It creates a new process
B. It terminates the calling process
C. It replaces the process image
D. It suspends the calling process
Correct Answer: C
Chapter: 7
Q174:
In the producer-consumer example, what is used to synchronize the producer and consumer?
A. Semaphore
B. Mutex
C. Shared buffer
D. Process priority
Correct Answer: C
Chapter: 7
Q175:
What is the main benefit of cooperating processes?
A. To execute independently
B. To share information and resources
C. To increase process priority
D. To run faster by using less CPU
Correct Answer: B
Chapter: 7
Q176:
The producer-consumer problem assumes a fixed-size buffer in the __________ version.
A. bounded buffer
B. unbounded buffer
C. dynamic buffer
D. circular buffer
Correct Answer: A
Chapter: 7
Q177:
The exec() system call is used in conjunction with which other system call?
A. fork()
B. wait()
C. exit()
D. exec()
Correct Answer: A
Chapter: 7
Q178:
In the code shown, what system call does the child process use after fork()?
A. exec()
B. fork()
C. wait()
D. exit()
Correct Answer: A
Chapter: 7
Q179:
What is the role of the 'in' variable in the producer-consumer problem?
A. To point to the next full position in the buffer
B. To point to the next empty position in the buffer
C. To track the buffer size
D. To track the buffer content
Correct Answer: B
Chapter: 7
Q180:
What will happen if the condition "in == out" is true in the producer process?
A. The producer will continue producing items
B. The producer will stop producing items
C. The producer will wait until space is available
D. The producer will reset the buffer
Correct Answer: C

Test Your Knowledge

Take a timed quiz on Operating System

🚀 Start Quiz Now