CS FundamentalsHardAmazon · Microsoft MCQ pattern
Reference string: 3, 1, 4, 3, 2, 1, 5, 3, 4, 1, 2, 5, 4. With 3 frames, initially empty, how many page faults does the Optimal (OPT) algorithm produce?
- A. 11
- B. 12
- C. 5
- D. 7
Correct answer: D. 7
OPT evicts the page used furthest in the future: faults on 3, 1, 4, then 2 (evict 4), 5 (evict 2), 4 (evict 3), 2 (evict 1): 7. FIFO on the same string gives 11, LRU 12, and 5 counts only the compulsory first-time misses.
More Operating Systems questions
- Assertion (A): For FIFO page replacement, increasing the number of frames can increase the number of page faults. Reason (R): FIFO is a…
- Five processes P0–P4 and three resource types A, B, C. Allocation: P0 (1,0,1), P1 (2,1,1), P2 (0,1,2), P3 (1,1,0), P4 (0,0,2). Max: P0…
- A system has 6 identical tape drives. Each of n processes needs at most 2 drives. What is the maximum n for which the system is guaranteed…
- How many of the following statements about deadlock are correct? 1. Requiring a process to request all its resources at once prevents…
- Semaphores S = 1 and T = 0. Process X runs: wait(S); print('A'); signal(T); Process Y runs: wait(T); print('B'); signal(S); Each runs its…
- Two threads each run the loop for (i = 0; i < 5; i++) count++; on a shared int count = 0, with no synchronisation. count++ is compiled to…