Question:

What will be the sequence of elements removed from the stack after performing the following operations?
Operations:
PUSH(10)
PUSH(20)
POP()
POP()
PUSH(30)
PUSH(40)
POP()
POP()
Options:
(A) 10
(B) 20
(C) 30
(D) 40
Choose the correct sequence from the options given below:

Updated On: Nov 4, 2024
  • (A), (B), (C), (D)
  • (B), (A), (D), (C)
  • (A), (B), (D), (C)
  • (B), (A), (C), (D)
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Following LIFO, the sequence will be 20 (first POP), 10 (second POP), 40 (third POP), and 30 (fourth POP).
Was this answer helpful?
0
0