ISRO CS-2023
January 24, 2024GATE 1995
January 24, 2024Question 11632 – Queues-and-Stacks
The following sequence of operations is performed on a stack:
PUSH ( 10 ). PUSH ( 20 ). POP. PUSH ( 10 ). PUSH ( 20 ). POP. POP. POP. PUSH ( 20 ). POP
The sequence of values popped out is
Correct Answer: B
Question 8 Explanation:
⇒ Push(10)
⇒ Push(20)
⇒ Pop 20
⇒ Push(10)
⇒ Push(20)
⇒ Pop 20
⇒ Pop 10
⇒ Pop 10
⇒ Push(20)
⇒ Pop 20
⇒ Push(20)
⇒ Pop 20
⇒ Push(10)
⇒ Push(20)
⇒ Pop 20
⇒ Pop 10
⇒ Pop 10
⇒ Push(20)
⇒ Pop 20
20, 10, 20, 10, 20
20, 20, 10, 10, 20
10, 20, 20, 10, 20
20, 20, 10, 20, 10
Subscribe
Login
0 Comments