OS_Lab_Exam_MCQ_Questions_All_20
OS_Lab_Exam_MCQ_Questions_All_20
A. OS
B. OS OS
C. Compile error
D. Runtime error
Answer: B
A. Orphan process
B. Zombie process
C. Deadlock
D. Parent-child loop
Answer: A
Answer: B
Answer: B
A. SJF scheduling
B. FCFS scheduling
C. Round Robin scheduling
D. Priority Scheduling
Answer: C
6. Q6. Identify the correct scheduling logic in this snippet:
for (int i = 0; i < n; i++)
if (arrival[i] < arrival[min] && !completed[i])
min = i;
A. FCFS
B. Round Robin
C. Priority Scheduling
D. SJF Non-preemptive
Answer: D
A. Writes to a file
B. Writes to stack
C. Writes to shared memory segment
D. Writes to socket
Answer: C
Answer: B
A. Ensure atomicity
B. Handle memory allocation
C. Manage CPU scheduling
D. Prevent deadlock
Answer: A
10. Q10. Which of the following memory allocation strategy does this simulate?
int memory[5] = {100, 500, 200, 300, 600};
// Logic: allocate to the first block that fits
A. Best-Fit
B. First-Fit
C. Worst-Fit
D. Paging
Answer: B
11. Q11. Which of these is a result of not releasing mutex properly in threads?
pthread_mutex_lock(&m);
// critical section without unlock
A. Deadlock
B. Race condition
C. Compilation error
D. Nothing
Answer: A
12. Q12. What will this shell command executed via system() do?
system("touch test.txt");
A. Removes file
B. Creates empty file
C. Edits file
D. Lists files
Answer: B
A. Optimal
B. LRU
C. FIFO
D. Clock
Answer: C
14. Q14. What happens if this C file handling code tries to read a non-existent file?
FILE *f = fopen("data.txt", "r");
A. Creates file
B. Returns NULL
C. Crashes
D. Infinite loop
Answer: B
A. Error
B. Threading
C. %s
D. Nothing
Answer: B
A. Kills processes
B. Lists all running processes
C. Starts processes
D. Compiles code
Answer: B
In another thread:
pthread_mutex_lock(&m2);
pthread_mutex_lock(&m1);
A. Compiles
B. Runtime error
C. Deadlock possibility
D. No issue
Answer: C
18. Q18. What is the output of this command used inside a C program?
system("ls > list.txt");
A. Deletes list.txt
B. Writes directory listing to list.txt
C. Shows directory on screen
D. Crashes system
Answer: B
A. exit()
B. kill(pid, SIGTERM)
C. abort()
D. All of the above
Answer: D
Answer: D