Open In App

ISRO | ISRO CS 2009 | Question 29

Like Article
Like
Save
Share
Report

The five items: A, B, C, D, and E are pushed in a stack, one after other starting from A. The stack is popped four items and each element is inserted in a queue. The 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


Answer: (D)

Explanation: When five items: A, B, C, D, and E are pushed in a stack:
Order of stack becomes: A, B, C, D, and E (A at the bottom and E at the top.)
stack is popped four items and each element is inserted in a queue:
Order of queue: B, C, D, E (B at rear and E at the front)
Order of stack after pop operations = A
Two elements deleted from the queue and pushed back on the stack:
New order of stack = A, E, D(A at the bottom, D at the top)
As D is on the top so when pop operation occurs D will be popped out.

So, correct option is (D).


Quiz of this Question


Last Updated : 05 Jun, 2018
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads