Operating System MCQs with Answers
Practice important Operating System MCQs with answers and explanations.
Multiple Choice Questions
Q211: What is the primary purpose of a pipe in UNIX/Linux?
- A: Communication between unrelated processes
- B: Communication between related processes
- C: Data storage
- D: File management
View Answer
B
Q212: A FIFO (Named Pipe) in UNIX/Linux is used for communication between:
- A: Related processes
- B: Unrelated processes
- C: Both related and unrelated processes
- D: Only one process
View Answer
C
Q213: The open() system call in UNIX/Linux is used to:
- A: Close a file
- B: Create or open a file
- C: Write data to a file
- D: Read data from a file
View Answer
B
Q214: In the open() system call, what does the 'O_RDONLY' flag specify?
- A: Open the file for reading
- B: Open the file for writing
- C: Open the file for both reading and writing
- D: Open the file in non-blocking mode
View Answer
A
Q215: What system call is used to read data from a file in UNIX/Linux?
- A: open()
- B: write()
- C: read()
- D: fork()
View Answer
C
Q216: What does the write() system call in UNIX/Linux do?
- A: Reads data from a file
- B: Opens a file for writing
- C: Writes data to a file
- D: Closes a file
View Answer
C
Q217: The close() system call is used to:
- A: Open a file
- B: Close a file descriptor
- C: Allocate a file descriptor
- D: Write data to a file
View Answer
B
Q218: The pipe system call can fail if:
- A: The file is locked
- B: Too many files or pipes are open
- C: The buffer size is too small
- D: The disk is full
View Answer
B
Q219: What happens if the read() system call fails?
- A: It returns 0
- B: It returns -1 and sets errno
- C: It automatically retries
- D: It terminates the program
View Answer
B
Q220: The file descriptor returned by the open() system call is used for:
- A: Reading and writing data
- B: Managing memory
- C: File creation
- D: Process termination
View Answer
A