Open In App

UGC-NET | UGC NET CS 2017 Jan – II | Question 22

Like Article
Like
Save
Share
Report

The seven elements A, B, C, D, E, F and G are pushed onto a stack in reverse order, i.e., starting from G. The stack is popped five times and each element is inserted into a queue.Two elements are deleted from the queue and pushed back onto the stack. Now, one element is popped from the stack. The popped item is ________.
(A) A
(B) B
(C) F
(D) G


Answer: (B)

Explanation: 22
In fig:-1 elements are inserted into a stack then in fig:-2 top 5 elements are popped and these 5 elements are inserted into a queue which is shown in fig:-3, now first two elements are deleted from queue and pushed into stack one by one which is shown in fig:-5.
At top of the stack element B is presented.
So, option (B) is correct.

Quiz of this Question


Last Updated : 27 May, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads