...
Question 8822 – Algorithms
May 4, 2024
UGC NET CS 2014 June-paper-2
May 4, 2024
Question 8822 – Algorithms
May 4, 2024
UGC NET CS 2014 June-paper-2
May 4, 2024

Question 10529 – Algorithms

Choose the correct alternatives (more than one may be correct) and write the corresponding letters only:
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 48 Explanation: 
PUSH(10), PUSH(20), POP = 20 (i)
→ PUSH(10), PUSH(10), PUSH(20), POP = 20 (ii)
→ PUSH(10), PUSH(10), POP = 10 (iii)
→ PUSH(10), POP = 10 (iv)
→ PUSH(20)
→ PUSH(20), POP = 20 (v)
20, 20, 10, 10, 20
A
20, 10, 20, 10, 20
B
20, 20, 10, 10, 20
C
10, 20, 20, 10, 20
D
20, 20, 10, 20, 10

Leave a Reply

Your email address will not be published. Required fields are marked *