Phase 7Ch 7.4 Final test
Thirty questions covering all phases. Set a timer and work on paper before opening the answer key.
Conventions: times in ms unless stated; KB = 2¹⁰ bytes; scheduling ties go to the earlier arrival; in round robin a process arriving when another is pre-empted joins the queue first; NAT decimals are accepted in a small range.
30 questions · 45 marks · 90 minutes. Negative marking on MCQ only: −1/3 mark for a wrong 1-mark MCQ, −2/3 for a wrong 2-mark MCQ. No negative marking for MSQ or NAT; MSQ has no partial credit.
Q1 · NAT · 1 mark(s) — Address bits
How many address bits are needed for 4 GB of byte-addressable memory?
Your answer:
Q2 · MCQ · 1 mark(s) — System calls
A user program switches from user mode to kernel mode to make a system call by:
- (A) disabling interrupts
- (B) changing the page table
- (C) a subroutine call into the kernel's code
- (D) a trap (software interrupt)
Q3 · MCQ · 1 mark(s) — PCB
Which of these is NOT stored in a process control block?
- (A) Process state
- (B) List of open files
- (C) The program's source code
- (D) Program counter
Q4 · MCQ · 1 mark(s) — Threads
With user-level threads mapped many-to-one, one thread makes a blocking system call. Then:
- (A) the whole process blocks
- (B) the kernel schedules another thread of the process
- (C) only that thread blocks
- (D) the call fails
Q5 · NAT · 1 mark(s) — FCFS
Jobs with bursts 10, 5, 2 arrive at time 0 in that order (FCFS). Average waiting time (2 decimals)?
Your answer:
Q6 · MCQ · 1 mark(s) — Pre-emption
Which of these scheduling algorithms is non-pre-emptive?
- (A) SRTF
- (B) HRRN
- (C) Pre-emptive priority
- (D) Round robin
Q7 · MCQ · 1 mark(s) — Requirements
Which requirement ensures that a process asking to enter its critical section will eventually get in, after a limited number of others?
- (A) Progress
- (B) Mutual exclusion
- (C) Bounded waiting
- (D) Atomicity
Q8 · NAT · 1 mark(s) — Semaphore
A semaphore starts at 3. Then 5 wait and 2 signal operations complete. Final value?
Your answer:
Q9 · MCQ · 1 mark(s) — Deadlock conditions
Which of these is NOT one of the four necessary conditions for deadlock?
- (A) Mutual exclusion
- (B) Circular wait
- (C) Hold and wait
- (D) Starvation
Q10 · NAT · 1 mark(s) — Minimum resources
4 processes each need at most 2 units of a resource. Minimum units so that deadlock is impossible?
Your answer:
Q11 · MCQ · 1 mark(s) — Fragmentation
External fragmentation can be removed by:
- (A) compaction
- (B) increasing the page size
- (C) using a TLB
- (D) using fixed partitions
Q12 · NAT · 1 mark(s) — Offset bits
How many offset bits are there with 8 KB pages?
Your answer:
Q13 · MCQ · 1 mark(s) — Belady
Belady's anomaly can occur with:
- (A) Optimal
- (B) FIFO
- (C) LRU
- (D) Any stack algorithm
Q14 · MCQ · 1 mark(s) — Working set
The working set of a process at time t with window Δ is:
- (A) the distinct pages referenced in its last Δ references
- (B) all pages the process will ever use
- (C) the last Δ pages loaded from disk
- (D) the pages currently in its frames
Q15 · NAT · 1 mark(s) — Latency
A disk spins at 12,000 rpm. Average rotational latency in ms?
Your answer:
Q16 · NAT · 2 mark(s) — fork()
How many times is "1" printed by if (fork() || fork()) fork(); printf("1");?
Your answer:
Q17 · NAT · 2 mark(s) — SRTF
A (arrival 0, burst 9), B (1, 4), C (2, 2), D (6, 3). SRTF: average turnaround time?
Your answer:
Q18 · NAT · 2 mark(s) — Pre-emptive priority
P1 (arrival 0, burst 5, priority 3), P2 (2, 3, 1), P3 (3, 4, 2), P4 (5, 2, 4); smaller number = higher priority. Pre-emptive priority: average waiting time?
Your answer:
Q19 · NAT · 2 mark(s) — Round robin
P1 (arrival 0, burst 5), P2 (1, 4), P3 (3, 2), P4 (4, 3); RR with quantum 2. Number of context switches (changes between different processes; the first dispatch not counted)?
Your answer:
Q20 · NAT · 2 mark(s) — CPU + I/O
FCFS on the CPU, separate I/O devices. A (arrival 0): CPU 2, I/O 3, CPU 4. B (arrival 1): CPU 3, I/O 2, CPU 1. C (arrival 2): CPU 1, I/O 6, CPU 2. When does C finish?
Your answer:
Q21 · NAT · 2 mark(s) — Race with semaphore
x = 0. P1 and P2 each do x = x + 3; P3 does x = x − 1; each brackets its read-modify-write with wait(S) … signal(S), and S starts at 2. How many different final values of x are possible?
Your answer:
Q22 · MSQ · 2 mark(s) — Semaphore code
Bounded buffer with mutex = 1, empty = N, full = 0. Which of these changes can cause a deadlock?
- (A) Consumer does
wait(mutex)beforewait(full) - (B) Producer does
signal(full)beforesignal(mutex) - (C) Consumer does
signal(empty)beforesignal(mutex) - (D) Producer does
wait(mutex)beforewait(empty)
Q23 · MCQ · 2 mark(s) — Banker's
Available (1, 2, 1). Allocation: P0 (0,1,3), P1 (1,2,2), P2 (2,3,0), P3 (0,3,3). Max: P0 (3,4,5), P1 (1,3,2), P2 (4,5,3), P3 (1,7,3). Which is a safe sequence?
- (A) P1, P0, P2, P3
- (B) P3, P1, P2, P0
- (C) P0, P1, P2, P3
- (D) P1, P2, P0, P3
Q24 · NAT · 2 mark(s) — Levels
40-bit virtual addresses, 4 KB pages, 4-byte entries; every page table fits in one page. Number of levels?
Your answer:
Q25 · NAT · 2 mark(s) — EAT
Two-level paging, memory access 100 ns, TLB 20 ns, hit ratio 0.9. EAT in ns?
Your answer:
Q26 · NAT · 2 mark(s) — LRU
Reference string 4 3 2 1 4 3 5 4 3 2 1 5, 3 empty frames, LRU. Number of page faults?
Your answer:
Q27 · NAT · 2 mark(s) — Max fault rate
ma = 80 ns, page-fault service 4 ms. Largest fault rate (in units of 10⁻⁶, 2 decimals) so that EAT ≤ 120 ns?
Your answer:
Q28 · NAT · 2 mark(s) — Inode
Inode with 10 direct, 1 single and 1 double indirect pointer; blocks 4 KB; pointers 8 bytes. Maximum file size in MB (2 decimals)?
Your answer:
Q29 · NAT · 2 mark(s) — C-SCAN
Head at 80; requests 45, 130, 10, 175, 90, 60, 150 (cylinders 0–199). C-SCAN towards higher cylinders, counting the return jump. Total head movement?
Your answer:
Q30 · NAT · 2 mark(s) — Interrupts
A disk delivers 1,024,000 bytes per second in 512-byte sectors, with one interrupt per sector costing 25 µs. Percentage of CPU time spent on these interrupts?
Your answer:
🎓 That is the whole course.
Final test answer key
Try the questions first. Open when you are ready to check.
Stop here until you have finished the 90-minute final test.
🔑 Open the full answer key
Q1 Answer: 32 · 1 mark(s)
2³² bytes.
Re-read: Lesson 0.1.1 — Inside a computer: CPU, memory, disk, I/O; bits, bytes and powers of two
Q2 Answer: (D) · 1 mark(s)
The trap sets kernel mode and jumps to a fixed handler.
- (A) is wrong: Privileged.
- (B) is wrong: Privileged.
- (C) is wrong: An ordinary call can't change the mode.
Re-read: Lesson 0.1.3 — System calls: how programs ask the operating system for help
Q3 Answer: (C) · 1 mark(s)
The PCB stores state needed to run and manage the process.
- (A) is wrong: Stored.
- (B) is wrong: Stored.
- (D) is wrong: Stored.
Re-read: Lesson 1.1.1 — Processes: memory layout, process control block and process states
Q4 Answer: (A) · 1 mark(s)
The kernel sees one process.
- (B) is wrong: The kernel doesn't know the threads.
- (C) is wrong: True for one-to-one kernel threads.
- (D) is wrong: No.
Re-read: Lesson 1.2.1 — Threads: what they share, user-level vs kernel-level threads
Q5 Answer: 8.33 to 8.34 · 1 mark(s)
(0 + 10 + 15)/3.
Re-read: Lesson 2.1.1 — Scheduling basics: the times we measure; first-come first-served
Q6 Answer: (B) · 1 mark(s)
It runs the chosen job to completion.
- (A) is wrong: Shorter arrivals pre-empt.
- (C) is wrong: By definition.
- (D) is wrong: Time slices pre-empt.
Re-read: Lesson 2.1.3 — Priority scheduling, starvation and aging; highest response ratio next
Q7 Answer: (C) · 1 mark(s)
A bound on others' entries.
- (A) is wrong: About the decision not being postponed.
- (B) is wrong: About exclusivity.
- (D) is wrong: Not one of the three.
Re-read: Lesson 3.1.1 — Race conditions and the critical-section problem
Q8 Answer: 0 · 1 mark(s)
3 − 5 + 2.
Re-read: Lesson 3.2.1 — Semaphores: wait, signal, counting and binary semaphores
Q9 Answer: (D) · 1 mark(s)
Starvation is a different problem.
- (A) is wrong: A condition.
- (B) is wrong: A condition.
- (C) is wrong: A condition.
Re-read: Lesson 4.1.1 — Deadlock: the four conditions and resource-allocation graphs
Q10 Answer: 5 · 1 mark(s)
4 × 1 + 1.
Re-read: Lesson 4.1.3 — Detection, recovery, and the minimum-resources formula
Q11 Answer: (A) · 1 mark(s)
Moving processes together merges the holes.
- (B) is wrong: Paging has no external fragmentation anyway.
- (C) is wrong: Unrelated.
- (D) is wrong: Causes internal fragmentation instead.
Re-read: Lesson 5.1.1 — Addresses and contiguous allocation: fits and fragmentation
Q12 Answer: 13 · 1 mark(s)
2¹³ = 8 K.
Re-read: Lesson 5.2.1 — Paging: pages, frames, page tables and the address split
Q13 Answer: (B) · 1 mark(s)
More frames can mean more faults with FIFO.
- (A) is wrong: Stack algorithm.
- (C) is wrong: Stack algorithm.
- (D) is wrong: Stack algorithms are immune.
Re-read: Lesson 5.3.2 — Page replacement: FIFO, optimal and LRU; Belady's anomaly
Q14 Answer: (A) · 1 mark(s)
The window looks back Δ references.
- (B) is wrong: Too large.
- (C) is wrong: Loads are not references.
- (D) is wrong: Frames may hold other pages.
Re-read: Lesson 5.3.3 — Frame allocation, thrashing, working sets and the clock algorithm
Q15 Answer: 2.5 · 1 mark(s)
5 ms per rotation / 2.
Re-read: Lesson 6.2.1 — Disk structure and access time
Q16 Answer: 5 · 2 mark(s)
The parent's first fork returns non-zero, so it runs the inner fork. Its first child got 0, so it calls the second fork; it gets non-zero and runs the inner fork too. The child of that second fork got 0 both times and skips it. 5 processes, one print each.
Re-read: Lesson 1.1.2 — Creating processes with fork(), exec() and wait(); context switches and schedulers
Q17 Answer: 7.5 · 2 mark(s)
A 0–1, B 1–2, C 2–4, B 4–7, D 7–10, A 10–18: TAT 18, 6, 2, 4.
Re-read: Lesson 2.1.2 — Shortest job first and shortest remaining time first
Q18 Answer: 4 · 2 mark(s)
P1 0–2, P2 2–5, P3 5–9, P1 9–12, P4 12–14: waits 7, 0, 2, 7.
Re-read: Lesson 2.1.3 — Priority scheduling, starvation and aging; highest response ratio next
Q19 Answer: 7 · 2 mark(s)
P1 P2 P1 P3 P4 P2 P1 P4.
Re-read: Lesson 2.2.1 — Round robin and the time quantum
Q20 Answer: 14 · 2 mark(s)
A 0–2, B 2–5, C 5–6, A 6–10, B 10–11, idle 11–12, C 12–14.
Re-read: Lesson 2.2.2 — Multilevel queues, CPU and I/O bursts, CPU utilisation
Q21 Answer: 5 · 2 mark(s)
−1, 2, 3, 5 and 6.
Re-read: Lesson 3.2.3 — Monitors, and reasoning about concurrent code
Q22 Answer: (A) (D) · 2 mark(s)
Waiting on a counting semaphore while holding the mutex blocks the other side.
- (B) is wrong: Signals never block.
- (C) is wrong: Signals never block.
Re-read: Lesson 3.2.2 — Classic problems: bounded buffer, readers–writers, dining philosophers
Q23 Answer: (D) · 2 mark(s)
Needs: P0 (3,3,2), P1 (0,1,0), P2 (2,2,3), P3 (1,4,0). Work (1,2,1) → P1 → (2,4,3) → P2 → (4,7,3) → P0 → (4,8,6) → P3.
- (A) is wrong: After P1, Work (2,4,3) can't cover P0's 3.
- (B) is wrong: P3 needs 4 of the second type; only 2 are free.
- (C) is wrong: P0 needs 3 of the first type; only 1 is free.
Re-read: Lesson 4.1.2 — Prevention and avoidance: safe states and the banker's algorithm
Q24 Answer: 3 · 2 mark(s)
1024 entries per page → 10 bits per level; 28 page bits.
Re-read: Lesson 5.2.2 — TLBs, effective access time and multilevel page tables
Q25 Answer: 140 · 2 mark(s)
0.9 × 120 + 0.1 × (20 + 300).
Re-read: Lesson 5.2.2 — TLBs, effective access time and multilevel page tables
Q26 Answer: 10 · 2 mark(s)
Every reference faults except the 4 and the 3 right after 5.
Re-read: Lesson 5.3.2 — Page replacement: FIFO, optimal and LRU; Belady's anomaly
Q27 Answer: 9.99 to 10.01 · 2 mark(s)
80 + p(4,000,000 − 80) ≤ 120.
Re-read: Lesson 5.3.1 — Demand paging, page faults and effective access time
Q28 Answer: 1026.03 to 1026.05 · 2 mark(s)
k = 512; (10 + 512 + 262144) × 4 KB.
Re-read: Lesson 6.1.2 — Allocation methods: contiguous, linked (FAT), indexed (inodes); free space
Q29 Answer: 378 · 2 mark(s)
119 to 199, 199 back to 0, 60 up to 60.
Re-read: Lesson 6.2.2 — Disk scheduling: FCFS, SSTF, SCAN, C-SCAN, LOOK, C-LOOK
Q30 Answer: 5 · 2 mark(s)
2000 interrupts × 25 µs = 0.05 s per second.
Re-read: Lesson 6.2.3 — I/O techniques: programmed I/O, interrupts, DMA, buffering and spooling
GATE 2027 · Operating Systems — Complete Notes · 58 of 58 roadmap items ready.