Data Structures & Algorithms Multiple Choice Questions on “First-in, First-out Algorithm (FIFO)”.
1. ________ is a typical online problem from the competitive analysis to determine the optimal solution. Answer: a 2. Which of the following is the simplest page replacement algorithm? Answer: a 3. __________ algorithm associates with each page the time when the page was brought into memory. Answer: b 4. As the number of frames available increases, the number of page faults decreases. 5. Which of the following page replacement algorithms return the minimum number of page faults? Answer: b 6. Which of the following is the main drawback of FIFO page replacement algorithm? Answer: c 7. Which of the following is required to determine the number of page faults in FIFO? Answer: b 8. In a FIFO algorithm, when a page is to be replaced, which of the following page is chosen? Answer: a 9. The cost required to execute a FIFO algorithm is expensive. Answer: b 10. FIFO algorithm is used by __________ operating system. Answer: d 11. What is the competitive analysis of the FIFO algorithm? Answer: d 12. Under which of the following scenarios is page replacement algorithm required? Answer: a 13. Consider a reference string: 14. Consider a reference string: 15. _________ states that, on a page fault, the frame that has been in memory the longest is replaced. Answer: a
a) Page replacement algorithm
b) Segmentation
c) Paging
d) Segmentation with paging
Clarification: Page replacement is a typical online problem from the competitive analysis. They determine which pages to page out or write to disk.
a) FIFO
b) Optimal page replacement
c) LRU replacement
d) Counting based replacement
Clarification: FIFO is the simplest page replacement algorithm since LRU and optimal replacement algorithms require past and future data patterns respectively.
a) Optimal page replacement
b) FIFO
c) LRU replacement algorithm
d) Counting based replacement
View Answer
Clarification: FIFO algorithm associates with each page the time when the page was brought into memory. The new page is inserted at the tail of the queue.
a) True
b) False
Answer: a
Clarification: One of the rules of the page replacement algorithm is that, as the number of frames available increases, the number of page faults decreases.
a) LRU replacement algorithm
b) Optimal page replacement algorithm
c) FIFO
d) Counting based replacement
Clarification: Though FIFO is the simplest of all algorithms, optimal page replacement algorithm returns the minimum number of page faults.
a) Requirement of large memory
b) Frame allocation
c) Reduction in multiprogramming
d) Reduced optimality
Clarification: The main drawback of FIFO page replacement algorithm is that it reduces the level of multiprogramming and also causes Belady’s anomaly.
a) Page number
b) Page frame number
c) Memory capacity
d) Segment number
Clarification: To determine the number of page faults in a page replacement algorithm using FIFO, we require page frame number.
a) Oldest page
b) Newest page
c) Frequently occurred page in past
d) Frequently occurred page in future
Clarification: In FIFO page replacement algorithm, when a page is to be replaced, the oldest page is chosen and replaced at the tail of the queue.
a) True
b) False
Clarification: The cost of a FIFO algorithm is cheap and intuitive and it is used in poor practical applications.
a) Linux
b) Mac
c) Windows
d) VAX/VMS
Clarification: Of the following given operating systems, VAX/VMS uses a FIFO algorithm.
a) k/k+1
b) k+1
c) k(k+1)
d) k/(k-h+1)
Clarification: The competitive analysis of a FIFO algorithm is mathematically found to be k/(k-h+1) where k and h are some constants used in page replacement and always, h<=k.
a) When total memory exceeds physical memory
b) To determine the number of frames for each process
c) When paging and segmentation are to be used
d) Execution of a process, not in memory
Clarification: An appropriate page replacement algorithm is required when the total memory requirements exceed the physical memory.
7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1 of frame size 3. Using FIFO algorithm, determine the number of page faults.
a) 12
b) 16
c) 14
d) 15
Clarification: For the given reference string of frame size 3, the number of page faults is calculated to be 15. It is explained in the diagram.
7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1 of frame size 4. Using FIFO algorithm, determine the number of page faults.
a) 12
b) 16
c) 10
d) 14
View Answer
Clarification: For the given reference string of frame size 4, the number of page faults is calculated to be 10. It is explained in the diagram.
a) Belady’s anomaly
b) Second chance algorithm
c) Partial second chance algorithm
d) LRU replacement algorithm
Clarification: Belady’s anomaly states that, on a page fault, the frame that has been in memory the longest is replaced. It occurs in FIFO algorithm.