Skip to main content

Operating System MCQs with Answers

Practice important Operating System MCQs with answers and explanations.

Chapter: 9
Q221:
UNIX/Linux pipes are typically used for communication between:
A. Related processes
B. Unrelated processes
C. Independent processes
D. Networked computers
Correct Answer: A
Chapter: 9
Q222:
A named pipe (FIFO) can be used for communication between:
A. Only related processes
B. Only unrelated processes
C. Both related and unrelated processes
D. Just one process at a time
Correct Answer: C
Chapter: 9
Q223:
In UNIX/Linux, what system call is used to close a file descriptor?
A. open()
B. close()
C. write()
D. read()
Correct Answer: B
Chapter: 9
Q224:
Which system call can fail if the buffer space in the kernel is not available?
A. pipe()
B. fork()
C. close()
D. wait()
Correct Answer: A
Chapter: 9
Q225:
The open system call can fail for the following reasons except:
A. Non-existent file
B. File permissions issue
C. Disk is full
D. File table is full
Correct Answer: D
Chapter: 9
Q226:
Which of the following commands would you use to read the contents of a file using a pipe operator?
A. cat file
B. grep "search_string" file
C. cat file
D. pipe
Correct Answer: A
Chapter: 9
Q227:
What does the wait() system call do in UNIX/Linux?
A. Starts a new process
B. Terminates the current process
C. Waits for the child process to finish
D. Opens a file
Correct Answer: C
Chapter: 9
Q228:
Which system call allows a process to write to a file in UNIX/Linux?
A. read()
B. open()
C. write()
D. fork()
Correct Answer: C
Chapter: 9
Q229:
The fork() system call is used to:
A. Create a new process
B. Open a file
C. Write data to a file
D. Read data from a file
Correct Answer: A
Chapter: 9
Q230:
Pipes in UNIX/Linux are used for:
A. Sharing files between processes
B. Communication between processes
C. File management
D. Storing data
Correct Answer: B
Chapter: 9
Q231:
Which of the following is true about the pipe() system call?
A. It is used for network communication
B. It allows data transfer between two unrelated processes
C. It enables communication between related processes
D. It is used for file management
Correct Answer: C
Chapter: 9
Q232:
Which of the following errors can occur during the open() system call?
A. The file is not found
B. The file is already open
C. The system is out of memory
D. All of the above
Correct Answer: D
Chapter: 9
Q233:
The system call wait() is used for:
A. Synchronizing threads
B. Waiting for a process to terminate
C. Opening a file
D. Reading from a pipe
Correct Answer: B
Chapter: 9
Q234:
The read() system call can fail due to which of the following reasons?
A. Invalid file descriptor
B. File not open
C. Disk is full
D. All of the above
Correct Answer: D
Chapter: 9
Q235:
The system call fork() is used to create:
A. A new thread
B. A new process
C. A new file descriptor
D. A new pipe
Correct Answer: B
Chapter: 9
Q236:
What is the main function of a pipe in interprocess communication in UNIX/Linux?
A. To allow processes to share memory
B. To enable communication between processes
C. To store data between processes
D. To write data to disk
Correct Answer: B
Chapter: 9
Q237:
UNIX/Linux system calls for file I/O include:
A. open(), read(), write(), close()
B. open(), write(), close(), remove()
C. create(), write(), read(), close()
D. create(), remove(), write(), open()
Correct Answer: A
Chapter: 10
Q238:
What is the purpose of input redirection in UNIX/Linux?
A. Redirect output to a file
B. Redirect error messages
C. Redirect input from a file
D. Redirect output to stderr
Correct Answer: C
Chapter: 10
Q239:
Which command syntax is used for input redirection in UNIX/Linux?
A. command < input-file
B. command > output-file
C. command 2> error-file
D. command | output-file
Correct Answer: A
Chapter: 10
Q240:
What does the ‘2>’ operator do in UNIX/Linux?
A. Redirect output to a file
B. Redirect error messages to a file
C. Redirect input from a file
D. Redirect standard input
Correct Answer: B

Test Your Knowledge

Take a timed quiz on Operating System

🚀 Start Quiz Now