Question 1
Consider that the following commands are executed in a shell with root (/) as the current directory.
What is the absolute path of the file README.md?
/project/src/README.md
/project/docs/README.md
/project/assets/docs/README.md
/README.md

The IIT Madras BS Operating Systems (Operating Systems) End Term paper sat on 10 May 2026, in the January 2026 term, set 1-2: 20 questions for 50 marks in 180 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.
Consider that the following commands are executed in a shell with root (/) as the current directory.
What is the absolute path of the file README.md?
/project/src/README.md
/project/docs/README.md
/project/assets/docs/README.md
/README.md
Correct answer
/project/docs/README.md
Consider the following resource-allocation situation.
• Process P1 holds resource R1 and waits for R2. • Process P2 holds resource R2 and waits for R3. • Process P3 holds resource R3 and waits for R4. • Process P4 holds resource R4 and waits for R1. • None of the processes releases its held resource until it acquires the requested one.
Which deadlock condition is most directly illustrated by the waiting pattern above?
Mutual exclusion
Preemption
Circular wait
Time sharing
Correct answer
Circular wait
If the memory map for a device starts at address 0x50002000 and has a size of 4096 bytes, what is the last valid address in the memory map?
0x50002FFE
0x50002FFF
0x50003000
0x50002000
Correct answer
0x50002FFF
Consider the following program. Assume execlp succeeds.
Which output order is guaranteed?
parent ready appears before hello
hello appears before parent ready
Only parent ready appears
The order is non-deterministic
Correct answer
hello appears before parent ready
Consider the following processes in an xv6-like operating system.
• Process P1 is waiting in the ready queue. • Process P2 is currently executing on the CPU. • Process P3 is blocked waiting for keyboard I/O. • Process P4 has terminated, but its parent has not yet called wait().
Select all correct statements.
P1 is in the RUNNABLE state.
P2 is in the RUNNING state.
P3 is in the SLEEPING state.
P4 is in the ZOMBIE state.
P3 is in the RUNNABLE state.
P4 is in the RUNNING state.
Correct answers
P1 is in the RUNNABLE state.
P2 is in the RUNNING state.
P3 is in the SLEEPING state.
P4 is in the ZOMBIE state.
Consider the following solution for the critical section problem using a shared variable turn. Initial value: turn = 1
Which of the following statements are correct?
Mutual exclusion is guaranteed.
The solution satisfies the progress condition.
Bounded waiting is guaranteed.
Deadlock can occur if one process is slow.
Correct answers
Mutual exclusion is guaranteed.
Bounded waiting is guaranteed.
Assume that context switches can occur at any time during execution. The variable counter is shared between two concurrent programs. Initial value: counter = 150
Which of the following can be the possible final values of counter?
115
135
170
150
155
185
Correct answers
115
135
170
Choose all correct statements regarding compiling and linking multiple C source files using gcc.
gcc file1.c file2.c -o output produces an executable named output.
gcc -c file1.c file2.c produces file1.o and file2.o.
gcc file1.o file2.o -o output links the object files into an executable named output.
gcc -c file1.c file2.c -o output produces an executable named output.
gcc file1.o file2.o -c -o output produces an executable named output.
Correct answers
gcc file1.c file2.c -o output produces an executable named output.
gcc -c file1.c file2.c produces file1.o and file2.o.
gcc file1.o file2.o -o output links the object files into an executable named output.
A system has 128 MiB of physical memory and uses a page size of 4 KiB. How many page frames are present in RAM? Assume 1 MiB = 220 bytes and 1 KiB = 210 bytes.
Correct answer: 32768
Consider the following processes, all arriving at time 0 and entering the ready queue in the order shown below.
If the CPU scheduling policy is Round Robin with time quantum 3, what is the average response time?
Correct answer: 4.5
Consider the code segment (for xv6) given below.
What are the base address and the end address of data_reg?
The base address is 0xE3005018, and the end address is 0xE300501A.
The base address is 0xE3005018, and the end address is 0xE300501B.
The base address is 0xE3005006, and the end address is 0xE3005009.
The base address is 0xE3005024, and the end address is 0xE3005027.
Correct answer
The base address is 0xE3005018, and the end address is 0xE300501B.
When a shell executes a command and then waits for it to finish before printing the next prompt, which sequence of system calls is most likely used?
exec → fork → wait
wait → fork → exec
fork → wait → exec
fork → exec → wait
Correct answer
fork → exec → wait
Consider the following code snippet.
Which of the following statements is correct?
The program creates two threads, each printing OS Lab 40 times, and Complete is printed only after both threads finish.
The program creates two threads, but Complete may appear before some thread outputs.
The program prints OS Lab exactly 40 times in total and then prints Complete.
The program executes the two threads sequentially because pthread_create() blocks.
Correct answer
The program creates two threads, each printing OS Lab 40 times, and Complete is printed only after both threads finish.
In xv6 on RISC-V, which register contains the system call number when the user process traps into the kernel?
a0
a7
sp
sepc
Correct answer
a7
Given the hexadecimal representation of the first few bytes of different files, identify the executable ELF file.
7F 45 58 45 01 01 01 00
7F 50 44 46 01 01 01 00
7F 45 4C 46 02 01 01 00
7F 4A 50 47 01 01 01 00
Correct answer
7F 45 4C 46 02 01 01 00
In a 64-bit RISC-V system, the scause register stores trap information. What will be the value of scause for an Environment call from S-mode?
0x8000000000000009
0x0000000000000009
0x0000000000000008
0x8000000000000008
Correct answer
0x0000000000000009
Consider the following processes scheduled using FCFS.
What is the average waiting time?
Correct answer: 4.25
A system uses a 32-bit virtual address space with a page size of 8 KiB and a single-level page table. How many entries are required in the page table? Assume 1 KiB = 210 bytes.
Correct answer: 524288
Consider the following processes scheduled using non-preemptive SJF.
What is the average response time?
Correct answer: 5.5
Consider the below plots representing the order in which the requests are serviced by different disk scheduling algorithms.
Match the above plots with the corresponding disk scheduling algorithm.
(1) – C-LOOK, (2) – C-SCAN, (3) – SCAN, (4) – SSTF
(1) – C-SCAN, (2) – FCFS, (3) – SSTF, (4) – C-LOOK
(1) – SSTF, (2) – SCAN, (3) – C-SCAN, (4) – C-LOOK
(1) – FCFS, (2) – C-LOOK, (3) – SSTF, (4) – SCAN
Correct answer
(1) – C-SCAN, (2) – FCFS, (3) – SSTF, (4) – C-LOOK