The five items: A, B, C, D, and E are pushed in a stack, one after the other…
2007
The five items: A, B, C, D, and E are pushed in a stack, one after the other starting from A. The stack is popped four times and each element is inserted in a queue. Then two elements are deleted from the queue and pushed back on the stack. Now one item is popped from the stack. The popped item is
- A.
A
- B.
B
- C.
C
- D.
D
Attempted by 152 students.
Show answer & explanation
Correct answer: D
After pushing A, B, C, D and E, the stack top is E.
Popping four items gives E, D, C, B into the queue in that order.
Deleting two queue items gives E and D; pushing them back puts D on the top of the stack. The next popped item is D.