# First-in, First-out Algorithm (FIFO) Multiple Choice Questions and Answers (MCQs)

This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “First-in, First-out Algorithm (FIFO)”.

1. ________ is a typical online problem from the competitive analysis to determine the optimal solution.
a) Page replacement algorithm
b) Segmentation
c) Paging
d) Segmentation with paging

Explanation: Page replacement is a typical online problem from the competitive analysis. They determine which pages to page out or write to disk.

2. Which of the following is the simplest page replacement algorithm?
a) FIFO
b) Optimal page replacement
c) LRU replacement
d) Counting based replacement

Explanation: FIFO is the simplest page replacement algorithm since LRU and optimal replacement algorithms require past and future data patterns respectively.

3. __________ algorithm associates with each page the time when the page was brought into memory.
a) Optimal page replacement
b) FIFO
c) LRU replacement algorithm
d) Counting based replacement

Explanation: 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.

4. As the number of frames available increases, the number of page faults decreases.
a) True
b) False

Explanation: One of the rules of the page replacement algorithm is that, 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?
a) LRU replacement algorithm
b) Optimal page replacement algorithm
c) FIFO
d) Counting based replacement

Explanation: Though FIFO is the simplest of all algorithms, optimal page replacement algorithm returns the minimum number of page faults.

6. Which of the following is the main drawback of FIFO page replacement algorithm?
a) Requirement of large memory
b) Frame allocation
c) Reduction in multiprogramming
d) Reduced optimality

Explanation: The main drawback of FIFO page replacement algorithm is that it reduces the level of multiprogramming and also causes Belady’s anomaly.

7. Which of the following is required to determine the number of page faults in FIFO?
a) Page number
b) Page frame number
c) Memory capacity
d) Segment number

Explanation: To determine the number of page faults in a page replacement algorithm using FIFO, we require page frame number.

8. In a FIFO algorithm, when a page is to be replaced, which of the following page is chosen?
a) Oldest page
c) Frequently occurred page in past
d) Frequently occurred page in future

Explanation: 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.

9. The cost required to execute a FIFO algorithm is expensive.
a) True
b) False

Explanation: The cost of a FIFO algorithm is cheap and intuitive and it is used in poor practical applications.

10. FIFO algorithm is used by __________ operating system.
a) Linux
b) Mac
c) Windows
d) VAX/VMS

Explanation: Of the following given operating systems, VAX/VMS uses a FIFO algorithm.

11. What is the competitive analysis of the FIFO algorithm?
a) k/k+1
b) k+1
c) k(k+1)
d) k/(k-h+1)

Explanation: 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.

12. Under which of the following scenarios is page replacement algorithm required?
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

Explanation: An appropriate page replacement algorithm is required when the total memory requirements exceed the physical memory.

13. Consider a reference string:
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

Explanation: 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.

14. Consider a reference string:
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

Explanation: 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.

15. _________ states that, on a page fault, the frame that has been in memory the longest is replaced.
b) Second chance algorithm
c) Partial second chance algorithm
d) LRU replacement algorithm

Explanation: 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.

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.