Operating System MCQs with Answers
Practice important Operating System MCQs with answers and explanations.
Multiple Choice Questions
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
View Answer
C
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
View Answer
D
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
View Answer
B
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
View Answer
D
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
View Answer
B
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
View Answer
B
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()
View Answer
A
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
View Answer
C
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
View Answer
A
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
View Answer
B