Which of the following elements will be present in a queue after the end of the following operation sequence? Assume the queue is empty initially.
enqueue(10)
enqueue(20)
enqueue(30)
dequeue()
enqueue(40)
dequeue()
enqueue(50)
enqueue(60)
(A) 60
(B) 30
(C) 20
(D) 50
Which of the following elements will be present in a queue after the end of the following operation sequence? Assume the queue is empty initially.
enqueue(10)
enqueue(20)
enqueue(30)
dequeue()
enqueue(40)
dequeue()
enqueue(50)
enqueue(60)
(A) 60
(B) 30
(C) 20
(D) 50
Solution
✅ Correct Option: 1
A queue is FIFO, so each dequeue removes the oldest element.
| Operation | Queue (front to rear) |
|---|---|
| enqueue(10) | 10 |
| enqueue(20) | 10, 20 |
| enqueue(30) | 10, 20, 30 |
| dequeue() | 20, 30 |
| enqueue(40) | 20, 30, 40 |
| dequeue() | 30, 40 |
| enqueue(50) | 30, 40, 50 |
| enqueue(60) | 30, 40, 50, 60 |
The final queue is 30, 40, 50, 60. Among the given elements, 60, 30 and 50 are present, which are (A), (B) and (D).
Options 2, 3 and 4: they include 20, which was removed by the second dequeue(), since it was the oldest element after 10 left.
Related questions:
2026: 20 May Shift 1
2025: 14 May Shift 1
2026: 29 May Shift 1
2026: 19 May Shift 1