Operating System MCQs with Answers
Practice important Operating System MCQs with answers and explanations.
Multiple Choice Questions
Q241: In the following command: "command < input-file", which file is used for input redirection?
- A: keyboard
- B: output-file
- C: input-file
- D: error-file
View Answer
C
Q242: What happens when you try to write to a FIFO that no process has opened for reading?
- A: The process is suspended
- B: A SIGPIPE signal is sent
- C: The process terminates
- D: An EOF is sent
View Answer
B
Q243: What system call is used to create FIFOs in UNIX/Linux?
- A: mknod()
- B: mkfifo()
- C: open()
- D: read()
View Answer
B
Q244: Which of the following is a feature of named pipes (FIFOs)?
- A: Temporary and used between related processes
- B: Created only with the open() system call
- C: Can be used between unrelated processes
- D: Requires a C library call to open
View Answer
C
Q245: What does the ‘1>’ operator do in UNIX/Linux?
- A: Redirects error messages to a file
- B: Redirects standard output to a file
- C: Redirects input to a file
- D: Redirects standard error to a file
View Answer
B
Q246: Which command is used to create a FIFO in UNIX/Linux?
- A: mknod
- B: ls
- C: mkfifo
- D: fifo
View Answer
C
Q247: In the following command, what happens: "command 2> error-file"?
- A: The command's output is saved to error-file
- B: The command’s error messages are saved to error-file
- C: The command’s standard input is saved to error-file
- D: The command reads input from error-file
View Answer
B
Q248: What does the mknod() system call do?
- A: Creates a FIFO
- B: Creates a file in the filesystem
- C: Executes a command
- D: Closes a file
View Answer
B
Q249: Which of the following is an example of error redirection in UNIX/Linux?
- A: $ cat > output.txt
- B: $ ls 2> error.log
- C: $ find < input.txt
- D: $ grep > output.txt
View Answer
B
Q250: FIFOs in UNIX/Linux are typically used for communication between:
- A: Related processes only
- B: Unrelated processes only
- C: Any processes
- D: Processes on different systems
View Answer
B