If the elements 1, 2, 3, and 4 are pushed, in this order, onto an initially…
2025
If the elements 1, 2, 3, and 4 are pushed, in this order, onto an initially empty stack, with no removals between pushes, what is the order in which all elements are popped?
Answer: C. 4321 — ConceptA stack follows the Last In, First Out (LIFO) rule: insertion and removal both occur at the top. Therefore, when several elements are pushed without…
- A.
1234
- B.
2134
- C.
4321
- D.
None of the above
Attempted by 918 students.
Show answer & explanation
Correct answer: C
Concept
A stack follows the Last In, First Out (LIFO) rule: insertion and removal both occur at the top.
Therefore, when several elements are pushed without any intervening pop, the pop order is the reverse of the push order.
Application
Begin with an empty stack.
Push 1, then 2, then 3, then 4. From bottom to top, the stack is [1, 2, 3, 4], so 4 is at the top.
Pop repeatedly: 4 leaves first, followed by 3, then 2, and finally 1.
Cross-check
Reversing the push order 1, 2, 3, 4 gives 4, 3, 2, 1, exactly as LIFO requires.
Thus, the removal order is 4321.