The sequence of elements in the stack from top to bottom after operations PUSH, PUSH, PUSH, POP, PUSH, POP, PUSH, PUSH, PUSH, POP on the elements 10, 12, 8, 15, 5, 3, 6, 18, 9, 11 will be:
(A) 12
(B) 3
(C) 10
(D) 5
The sequence of elements in the stack from top to bottom after operations PUSH, PUSH, PUSH, POP, PUSH, POP, PUSH, PUSH, PUSH, POP on the elements 10, 12, 8, 15, 5, 3, 6, 18, 9, 11 will be:
(A) 12
(B) 3
(C) 10
(D) 5
Solution
✅ Correct Option: 4
Take the elements in order, using one for each PUSH. A POP removes the top element and uses none.
| Operation | Stack (bottom to top) |
|---|---|
| PUSH 10 | 10 |
| PUSH 12 | 10, 12 |
| PUSH 8 | 10, 12, 8 |
| POP (removes 8) | 10, 12 |
| PUSH 15 | 10, 12, 15 |
| POP (removes 15) | 10, 12 |
| PUSH 5 | 10, 12, 5 |
| PUSH 3 | 10, 12, 5, 3 |
| PUSH 6 | 10, 12, 5, 6 is not formed; the stack is 10, 12, 5, 3, 6 |
| POP (removes 6) | 10, 12, 5, 3 |
Read from top to bottom, the stack is 3, 5, 12, 10, which is (B), (D), (A), (C).
Related questions:
2025: 30 May Shift 2
2025: 14 May Shift 1
2026: 11 May Shift 2
2026: 19 May Shift 1