Skip to main contentSkip to solution

If the elements "red", "blue", "green" and "yellow" are inserted in a stack in order. Select from the option given below, as they are deleted from the stack one at a time:-

(A) red

(B) blue

(C) green

(D) yellow

Solution

✅ Correct Option: 2

A stack follows LIFO (Last In, First Out): the element inserted last is deleted first.

Insertion order is red, blue, green, yellow, so deletion order is yellow, green, blue, red, which is (D), (C), (B), (A).


Option 1: this is the order a queue (FIFO) would give, not a stack.

Keyboard Shortcuts

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