Page Replacement Questions with Answers

38 practice questions on Page Replacement (Operating Systems) with answers and step-by-step solutions. Try 10 samples below, then practise all 38 free in the AptiNest app.

Sample questions

Question 1Easy

Which algorithm is simplest to implement, needing only a queue of pages in load order?

  1. Optimal
  2. LRU
  3. FIFO
  4. Working-set

Answer: C. FIFO

Explanation

FIFO only tracks load order with a queue: the page at the head is replaced.

Step-by-step solution

  1. FIFO only needs a queue of pages in load order.
  2. Optimal needs future knowledge; LRU needs last-use tracking; working-set needs a window of recent references.
  3. So FIFO is the simplest, which is option C.

Why the other options are wrong

  • A. Optimal needs future knowledge of references, so it is not simple to build.
  • B. LRU needs last-use tracking, which is more than a simple queue.
  • D. The working-set method needs tracking of recent references in a window.

Tip: FIFO is simple because load order never changes; LRU must update order on every hit.

Question 2Easy

Which page replacement algorithm can suffer from Belady's anomaly?

  1. FIFO
  2. Optimal
  3. LRU
  4. Both LRU and Optimal

Answer: A. FIFO

Explanation

FIFO is not a stack algorithm, so adding frames can increase faults. LRU and Optimal are stack algorithms and never show Belady's anomaly.

Step-by-step solution

  1. FIFO replaces the oldest page in memory.
  2. Adding more frames can cause more page faults in FIFO.
  3. LRU and Optimal use future knowledge to avoid faults.
  4. Only FIFO can suffer from Belady's anomaly.

Why the other options are wrong

  • B. Optimal is a stack algorithm, so it never shows Belady's anomaly and more frames never add faults for it.
  • C. LRU is a stack algorithm, so adding frames never increases its page faults and it does not show the anomaly.
  • D. LRU does not suffer Belady's anomaly, so the option naming both LRU and Optimal is wrong.

Tip: Remember: Only FIFO suffers from Belady's anomaly.

Question 3Easy

Which page replacement algorithm is optimal but impossible to implement exactly in practice?

  1. Clock
  2. Least Recently Used (LRU)
  3. Optimal (Belady's MIN)
  4. FIFO

Answer: C. Optimal (Belady's MIN)

Explanation

OPT needs to know future references; it is used as a benchmark for comparing practical algorithms.

Step-by-step solution

  1. Optimal algorithm uses future page references to make decisions.
  2. It requires knowing which pages will be needed next.
  3. This information is not available in real-time systems.
  4. Thus, it cannot be implemented exactly in practice.
  5. The correct answer is Optimal (Belady's MIN).

Why the other options are wrong

  • A. Clock is a practical approximation of LRU that uses reference bits, so it can be implemented and is not the optimal one.
  • B. LRU is a practical algorithm that hardware approximates, and it is not the optimal algorithm.
  • D. FIFO is simple to implement with a queue, and it is not optimal either.

Tip: Remember: Optimal is the best but not practical.

Question 4Easy

A reference string contains 9 distinct pages and memory has 20 frames, all initially empty. How many page faults occur under any replacement algorithm?

  1. 9
  2. 20
  3. 0
  4. 11

Answer: A. 9

Explanation

With more frames than distinct pages, only the first reference to each page faults (compulsory misses), giving 9 faults.

Step-by-step solution

  1. Each distinct page must be loaded once, the first time it is used.
  2. There are 9 distinct pages, so 9 faults happen at minimum.
  3. With 20 empty frames nothing is evicted, so no other fault can occur for any algorithm.
  4. The answer is 9, which is option A.

Why the other options are wrong

  • B. 20 is the frame count; only 9 pages are ever loaded.
  • C. 0 would mean every page is already in memory, but pages must be loaded first.
  • D. 11 is more than the 9 distinct pages, which cannot happen with empty frames and no evictions.

Tip: With enough empty frames, faults equal the number of distinct pages, under any algorithm.

Question 5Medium

How many page faults occur with LRU replacement and 3 frames (initially empty) for the reference string:

7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1

  1. 12
  2. 15
  3. 9
  4. 10

Answer: A. 12

Explanation

Simulating LRU gives 8 hits out of 20 references, so 20 - 8 = 12 page faults.

Step-by-step solution

  1. With LRU, a miss evicts the page whose most recent use is oldest.
  2. The misses occur at 7, 0, 1, 2, 3, 4, 2, 3, 0, 1, 0, 7 in the reference string.
  3. That is 12 page faults, the correct answer.

Why the other options are wrong

  • B. 15 is the FIFO count for this string, not the LRU count.
  • C. 9 is the optimal (OPT) count for this string, not the LRU count.
  • D. 10 is not the LRU count; tracing the string gives 12 misses.

Tip: For LRU, a hit moves the page to most recent; on a miss, evict the page at the least recent end.

Question 6Medium

Using LRU with 3 initially empty frames, which pages are in memory after processing the reference string 3, 1, 4, 3, 2, 5, 1, 3?

  1. {1, 3, 5}
  2. {1, 4, 3}
  3. {3, 2, 5}
  4. {2, 5, 1}

Answer: A. {1, 3, 5}

Explanation

The last three distinct pages referenced are 5, 1 and 3, and LRU always keeps the most recently used pages, so memory holds {1, 3, 5}.

Step-by-step solution

  1. Refs 3, 1, 4 fill the frames; the next 3 is a hit (last use at position 4).
  2. 2 faults; LRU evicts 1 (last used at position 2). Set becomes 4, 3, 2.
  3. 5 faults; LRU evicts 4 (last used at position 3). Set becomes 3, 2, 5.
  4. 1 faults and evicts 3; 3 faults and evicts 2. Final set is 5, 1, 3, which is option A.

Why the other options are wrong

  • B. {1, 4, 3} keeps 4, but 4 was evicted when 5 arrived because it was least recently used.
  • C. {3, 2, 5} is the set after 5 arrives, before the final 1 and 3 are loaded.
  • D. {2, 5, 1} is the set after the 1 reference, before the final 3 is loaded.

Tip: For LRU, the last-use time decides the victim; track it for every page in memory.

Question 7Medium

An LRU approximation keeps an 8-bit history byte per page and, at each timer tick, shifts the byte right and puts the reference bit in the high-order bit. Which page is evicted?

  1. The page loaded first
  2. The page whose byte has the smallest value
  3. The page with the most 1 bits in the low half
  4. The page whose byte has the largest value

Answer: B. The page whose byte has the smallest value

Explanation

Recent references set high-order bits, so a smaller unsigned value means the page was used less recently (the aging algorithm).

Step-by-step solution

  1. Each timer tick shifts the history byte right and sets the reference bit in the high-order bit.
  2. The high-order bit reflects recent usage, so a smaller value means less recent use.
  3. Smaller unsigned values indicate pages that were used less recently.
  4. LRU approximation evicts the page with the smallest byte value.
  5. The page whose byte has the smallest value is evicted.

Why the other options are wrong

  • A. Load order is what FIFO uses; the history byte records recent use, so the page loaded first is not evicted.
  • C. Counting 1 bits in the low half is not the rule; the high-order bit shows recent use and the smallest byte is evicted.
  • D. The largest byte is the most recently used page, which should be kept, not evicted.

Tip: Smallest byte value = least recently used = evicted first.

Question 8Medium

For a reference string of length 20 that contains 6 distinct pages, with 3 frames, what are the lower and upper bounds on the number of page faults?

  1. At least 6 and at most 17
  2. At least 6 and at most 20
  3. At least 3 and at most 6
  4. At least 0 and at most 20

Answer: B. At least 6 and at most 20

Explanation

Each distinct page must fault at least once (6), and in the worst case every reference faults (20).

Step-by-step solution

  1. Minimum page faults = number of distinct pages = 6.
  2. Maximum page faults = length of reference string = 20.
  3. So lower bound is 6 and upper bound is 20.
  4. Final answer: At least 6 and at most 20.

Why the other options are wrong

  • A. At most 17 is too low; every one of the 20 references can cause a fault, so the upper bound is 20.
  • C. At most 6 is too low, and at least 3 is too low; the minimum is 6, one fault for each distinct page.
  • D. The lower bound is 6, not 0, since each of the 6 distinct pages must be loaded at least once.

Tip: Minimum = distinct pages, Maximum = reference string length.

Question 9Hard

In the enhanced second-chance algorithm using (reference, modify) bit pairs, which class of page is the best candidate for replacement?

  1. (0, 0)
  2. (1, 0)
  3. (0, 1)
  4. (1, 1)

Answer: A. (0, 0)

Explanation

(0, 0) means neither recently used nor modified, so it is unlikely to be needed and needs no write-back before eviction.

Step-by-step solution

  1. Reference bit 0 means the page was not recently referenced.
  2. Modify bit 0 means the page has not been modified since last loaded.
  3. Both bits 0 indicate the page is least likely to be needed again.
  4. No write-back is required as the page is clean and unused.
  5. This makes (0, 0) the best candidate for replacement.

Why the other options are wrong

  • B. (1, 0) was recently used and is clean, so it should be kept longer and is not the best candidate.
  • C. (0, 1) is not recently used but is modified, so it needs a write-back first and is worse than (0, 0).
  • D. (1, 1) was recently used and is modified, so it is the worst candidate for replacement.

Tip: Always replace pages with (0, 0) in second-chance algorithm.

Question 10Hard

For the reference string 0, 1, 2, 3, 0, 1, 4, 0, 1, 2, 3, 4, what is the page hit ratio using FIFO with 4 initially empty frames?

  1. 3/12
  2. 10/12
  3. 4/12
  4. 2/12

Answer: D. 2/12

Explanation

FIFO with 4 frames gives 10 faults, so 2 hits out of 12 references. (With 3 frames FIFO gives 9 faults: Belady's anomaly.)

Step-by-step solution

  1. FIFO with 4 frames: 0, 1, 2, 3 fill the frames (4 faults). The next 0 and 1 are hits.
  2. 4 faults and evicts 0; 0 faults and evicts 1; 1 faults and evicts 2; 2 faults and evicts 3; 3 faults and evicts 4; 4 faults and evicts 0.
  3. Total faults = 10, so hits = 12 minus 10 = 2.
  4. Hit ratio = hits ÷ references = 2/12, which is option D.

Why the other options are wrong

  • A. 3/12 counts 3 hits; only the two reuses of 0 and 1 are hits.
  • B. 10/12 is the fault count, not the hit count.
  • C. 4/12 would need 4 hits; FIFO gets only 2.

Tip: Hit ratio = hits ÷ total references; hits = references minus faults.

Practise all 38 questions free

The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.

Open this topic in the app →

Related topics

See all Operating Systems topics · All topics