Skip to main content

Operating System MCQs with Answers

Practice important Operating System MCQs with answers and explanations.

Chapter: 7
Q181:
In the producer-consumer problem, what does the "out" variable represent?
A. The next available slot for a consumer
B. The next available slot for a producer
C. The buffer size
D. The producer's current position
Correct Answer: A
Chapter: 7
Q182:
In the given code, which system call is used to check if execlp() fails?
A. exit()
B. perror()
C. wait()
D. printf()
Correct Answer: B
Chapter: 7
Q183:
The fork() system call creates a __________ process.
A. Child
B. Parent
C. New
D. Zombie
Correct Answer: A
Chapter: 7
Q184:
What happens when a process calls wait() with no child processes to wait for?
A. It waits indefinitely
B. It terminates the process immediately
C. It returns immediately
D. It returns after a delay
Correct Answer: C
Chapter: 7
Q185:
In the code example provided, if the fork() fails, what does the parent process do?
A. It creates a new process
B. It terminates the process
C. It prints an error message
D. It executes wait()
Correct Answer: B
Chapter: 8
Q186:
What is the function of a message passing system in Interprocess Communication (IPC)?
A. To allow processes to communicate
B. To share memory between processes
C. To control the flow of processes
D. To sync processes without using shared address space
Correct Answer: A
Chapter: 8
Q187:
Which of the following is NOT a common IPC tool in UNIX/Linux?
A. Pipe
B. Named Pipe (FIFO)
C. Message Queue
D. Semaphore
Correct Answer: D
Chapter: 8
Q188:
What does direct communication in IPC require?
A. A shared mailbox between processes
B. Explicit naming of recipient/sender
C. A link established by the operating system
D. An indirect buffer storage
Correct Answer: B
Chapter: 8
Q189:
Which of the following describes blocking send in IPC?
A. The sender continues immediately after sending
B. The sender is blocked until the receiver gets the message
C. The sender writes the message to a file
D. The sender never blocks
Correct Answer: B
Chapter: 8
Q190:
The UNIX/Linux pipe() system call is used for ______.
A. Establishing a two-way communication channel
B. Creating a communication link between two processes
C. Creating a temporary file for process I/O
D. Connecting standard input and output of different processes
Correct Answer: B
Chapter: 8
Q191:
In UNIX/Linux IPC, what does the pipefd[0] descriptor represent in the child process?
A. Read end of the pipe
B. Write end of the pipe
C. A communication channel with the parent process
D. The mailbox for the process
Correct Answer: A
Chapter: 8
Q192:
Which of the following is true about indirect communication in IPC?
A. Processes must share a mailbox to communicate
B. Messages are always sent directly between processes
C. Every process has its own mailbox
D. Communication occurs only through a shared memory
Correct Answer: A
Chapter: 8
Q193:
What does the write() system call do in UNIX/Linux?
A. Reads data from a file descriptor
B. Closes a file descriptor
C. Writes data to a file descriptor
D. Creates a communication link between processes
Correct Answer: C
Chapter: 8
Q194:
In UNIX/Linux, a pipe is referred to as a ________ channel for communication.
A. Full-duplex
B. Half-duplex
C. Bounded-buffer
D. Synchronization channel
Correct Answer: B
Chapter: 8
Q195:
What happens if the write() system call fails in UNIX/Linux?
A. It returns 0 indicating successful writing
B. It returns -1 and sets errno
C. It retries the operation
D. It closes the file descriptor automatically
Correct Answer: B
Chapter: 8
Q196:
The read() system call in UNIX/Linux is used to ______.
A. Write data to a file descriptor
B. Read data from a file descriptor
C. Close a file descriptor
D. Create a new file descriptor
Correct Answer: B
Chapter: 8
Q197:
The close() system call in UNIX/Linux does NOT perform which of the following actions?
A. Close a file descriptor
B. Frees resources associated with the file descriptor
C. Sets the file position pointer to the beginning
D. Deletes a file
Correct Answer: D
Chapter: 8
Q198:
Which of the following is a characteristic of zero-capacity buffering in IPC?
A. The sender does not block
B. The queue length is infinite
C. The sender blocks until the message is received
D. The queue is capable of storing multiple messages
Correct Answer: C
Chapter: 8
Q199:
A pipe in UNIX/Linux is primarily used for ______ communication.
A. One-way
B. Two-way
C. Three-way
D. Multi-channel
Correct Answer: A
Chapter: 8
Q200:
What is the primary use of the fork() system call in UNIX/Linux IPC?
A. To create a copy of the parent process
B. To wait for a child process to finish
C. To write data into a pipe
D. To create a communication link between processes
Correct Answer: A

Test Your Knowledge

Take a timed quiz on Operating System

🚀 Start Quiz Now