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
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.
Related questions:
2026: 20 May Shift 1
2026: 18 May Shift 2
2026: 23 May Shift 2
2025: 15 May Shift 2