IF STACK 'S' is implemented with the list, having elements [23,24,35,37], The TOP of the STACK element is 37. After that, the following operations take place in sequence.
- PUSH(40)
- PUSH(43)
3.POP( )
- PUSH(56)
What will be the order of elements in the STACK 'S' after the completion of the above operations?
IF STACK 'S' is implemented with the list, having elements [23,24,35,37], The TOP of the STACK element is 37. After that, the following operations take place in sequence.
- PUSH(40)
- PUSH(43)
3.POP( )
- PUSH(56)
What will be the order of elements in the STACK 'S' after the completion of the above operations?
Solution
✅ Correct Option: 1
A stack follows LIFO (last in, first out): PUSH adds at the top (end of the list) and POP removes the top element.
| Operation | Stack (bottom to top) |
|---|---|
| Start | 23, 24, 35, 37 |
| PUSH(40) | 23, 24, 35, 37, 40 |
| PUSH(43) | 23, 24, 35, 37, 40, 43 |
| POP() removes 43 | 23, 24, 35, 37, 40 |
| PUSH(56) | 23, 24, 35, 37, 40, 56 |
Option 2: ignores the POP and the final PUSH(56).
Option 3: wrongly removes 40, but POP removes the most recent push, which is 43.
Related questions:
2026: 11 May Shift 2
2026: 11 May Shift 2
2025: 27 May Shift 2
2026: 31 May Shift 1
2026: 29 May Shift 2