The elements A, B, C, D, E are to be entered in an empty queue starting from A. The following operations are performed:
Enqueue(), Enqueue(), Enqueue(), Dequeue(), Enqueue(), Dequeue()
What will be the status of the queue after the above operation?
The elements A, B, C, D, E are to be entered in an empty queue starting from A. The following operations are performed:
Enqueue(), Enqueue(), Enqueue(), Dequeue(), Enqueue(), Dequeue()
What will be the status of the queue after the above operation?
Solution
✅ Correct Option: 1
A queue is first in, first out (FIFO): Enqueue adds at the rear and Dequeue removes from the front. The elements are taken in the order A, B, C, D, E.
| Operation | Queue (front to rear) |
|---|---|
| Enqueue() | A |
| Enqueue() | A, B |
| Enqueue() | A, B, C |
| Dequeue() | B, C |
| Enqueue() | B, C, D |
| Dequeue() | C, D |
Options 2 and 4: there are only four Enqueue operations, so E is never entered.
Related questions:
2026: 19 May Shift 1
2026: 29 May Shift 2