Skip to main contentSkip to solution

If the Elements "P", "Q", "R", "S" are inserted in order in the Stack and are deleted one at a time, then what will be the order of removal of elements?

(A) P

(B) Q

(C) R

(D) S

Solution

✅ Correct Option: 2

A stack follows LIFO (Last In, First Out): the element pushed last is removed first. Since P, Q, R, S are inserted in that order, S is on top and comes out first, then R, then Q, then P.

Removal order: S, R, Q, P, which is (D), (C), (B), (A).


Option 1: this is the order of removal in a queue (FIFO), a common confusion with a stack.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question