Consider an empty queue and the order of given elements fom left to right.
[35, 55, 15, 62, 43, 24]
What will be the front element of the queue list after following operations are performed?
- ENQUEUE
- ENQUEUE
- PEEK
- DEQUEUE
- ENQUEUE
- DEQUEUE
- DEQUEUE
- ENQUEUE
Consider an empty queue and the order of given elements fom left to right.
[35, 55, 15, 62, 43, 24]
What will be the front element of the queue list after following operations are performed?
- ENQUEUE
- ENQUEUE
- PEEK
- DEQUEUE
- ENQUEUE
- DEQUEUE
- DEQUEUE
- ENQUEUE
Solution
✅ Correct Option: 2
A queue is first in, first out: ENQUEUE adds the next element from the list at the rear, DEQUEUE removes the front element, and PEEK only reads the front without removing it.
| Operation | Queue (front on left) |
|---|---|
| 1. ENQUEUE 35 | 35 |
| 2. ENQUEUE 55 | 35, 55 |
| 3. PEEK (returns 35) | 35, 55 |
| 4. DEQUEUE (removes 35) | 55 |
| 5. ENQUEUE 15 | 55, 15 |
| 6. DEQUEUE (removes 55) | 15 |
| 7. DEQUEUE (removes 15) | empty |
| 8. ENQUEUE 62 | 62 |
Option 4: 35 was the front only until the first DEQUEUE. PEEK does not remove it.
Option 1: 15 is removed by the second DEQUEUE (operation 7).
Option 3: 43 is never reached, because only four ENQUEUE operations are performed.
Related questions:
2026: 31 May Shift 1
2026: 29 May Shift 1
2025: 16 May Shift 1