Random Page Replacement Algorithm Multiple Choice Questions and Answers (MCQs)

This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “Random Page Replacement Algorithm”.

1. Which among the following algorithms can be used to decide which page should be replaced when the new page comes in?
a) Karatsuba algorithm
b) DSW algorithm
c) Page replacement algorithm
d) Aging algorithm
View Answer

Answer: c
Explanation: The page replacement algorithm in operating systems, is used to decide which page should be evicted when the new page comes in. The basic idea of these algorithms is to reduce the number of page faults that occur.

2. The random page replacement algorithm may suffer from Belady’s anomaly.
a) True
b) False
View Answer

Answer: a
Explanation: Belady’s anomaly depicts that with the increase in the number of page frames, the number of page faults also increases. It is in context with the FIFO page replacement policy. Since random page replacement algorithm replaces the page randomly, it may behave like FIFO and thus it may suffer from belady’s anomaly.

3. The random page replacement algorithm fares better than which of the following algorithm?
a) Optimal page replacement algorithm
b) LIFO
c) FIFO
d) Not frequently used algorithm
View Answer

Answer: c
Explanation: The random page replaces a page randomly from the frame. Here, we cannot predict the future at all. The best case, worst case and average case are all same for this algorithm. It is also easy to implement. Hence, it fares better than FIFO.
advertisement
advertisement

4. Consider the given page reference string 0, 1, 3, 7, 1, 7, 0, 3, 6, 8. How many page faults will occur if the program has 4-page frames available to it and it uses the random page replacement algorithm?
a) 6
b) 7
c) 8
d) 9
View Answer

Answer: a
Explanation: All the slots are empty initially, 0 1 3 7 are allocated → 4 page faults. 1 is already present → 0 page fault. 7 is already present → 0 page fault. 0 is already present → 0 page fault. 3 is already present → 0 page fault. When 6 came, randomly replace it with any of the page → 1 page fault. When 8 came, randomly replace it with any of the page → 1 page fault. Hence, total 6 page faults.

5. In the random page replacement algorithm, if the current page doesn’t exist in the frame then it is replaced with which of the following page?
a) Recently used page
b) Least recently used page
c) Any random page
d) The first page of the frame
View Answer

Answer: c
Explanation: In the random page replacement algorithm, as the name suggests replaces any random page from the set. Hence, if the current page doesn’t exist in the set, then it is replaced with any random page.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. Consider the following pseudocode for the random page replacement algorithm. Which of the following best suits the blank?

Start traversing the pages                                                       
if pages < capacity   
{
    insert the pages until the size of the set reaches capacity or all the pages are processed   
    maintain the pages in a queue         
    increment page fault 
}
else if
{
    current page is present in the set
    do nothing 
}
else 
{
    replace the current page with __________
    store current page in the queue 
    increment page fault
} 
return page faults

a) any random page
b) recently used page
c) least recently used page
d) the first page of the frame
View Answer

Answer: a
Explanation: In the random page replacement algorithm, while traversing the pages, if the pages are less than the capacity, keep adding the pages until the set reaches the capacity. Increment the page fault. If the current page is present in the set, gives 0 page fault. Hence, do nothing, else replace the page randomly with any page of the set and increment the page fault.
advertisement

7. Random page replacement algorithm may behave like any other page replacement algorithms.
a) True
b) False
View Answer

Answer: a
Explanation: In the random page replacement algorithm, if the page doesn’t exist in the set then it is replaced by any of the pages from the set. Hence, it may behave like FIFO, LIFO, LRU, Optimal, etc. any of the page replacement algorithm.
advertisement

8. Which of the following is a characteristic of random page replacement algorithm?
a) It replaces the page that has been present in the main memory for the longest
b) It uses a queue data structure for implementation
c) It eliminates the overhead cost of tracking page reference
d) It cannot be implemented
View Answer

Answer: c
Explanation:  In FIFO page replacement algorithm, the page that has been in the memory for the longest amount of time is replaced and it uses queue data structure for implementation. Optimal page replacement algorithm cannot be implemented because the future cannot be predicted. In random page replacement algorithm, the memory page is replaced randomly and hence we do not need to track the page reference.

Sanfoundry Global Education & Learning Series – Data Structures & Algorithms.

To practice all areas of Data Structures & Algorithms, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.