Data Structures

1:

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.

E

B.

B

C.

C

D.

D

 

Answer : D

Explanation :

In queue elements are deleted from front (FIFO) and in stacks elements are popped from top (LIFO)

stack

silpa said: (10:32pm on Thursday 2nd July 2015)
the first popped element from stack is 'e' then 'd','c','b' respectively.According to FIFO,first inserted element(e)is deleted first then 'd' is also deleted. then how become 'd' is answer??

Write your comments here:


Report Error
 

Option: A

Explanation : Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here.