recategorized
7,192 views
1 votes
1 votes

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 ___________.

  1. $A$
  2. $B$
  3. $F$
  4. $G$
recategorized

3 Answers

Best answer
2 votes
2 votes

push G F E D C B A :

Stack is : 

A

B

C

D

E

F

G

pop 5 times

F

G

insert popped in queue:  (rear)   E D C B A (front)

delete 2 from queue: (rear)   E D C  (front)

push in stack

B

A

POP 1: B

so answer is B

option 2

Answer:

Related questions

1 votes
1 votes
7 answers
1
go_editor asked Mar 24, 2020
1,517 views
Which of the following is a valid heap? $a$$b$$c$$d$
2 votes
2 votes
6 answers
2
0 votes
0 votes
4 answers
4
go_editor asked Mar 24, 2020
989 views
Match the following :$\begin{array}{llll} & \textbf{List – I} & {} & \textbf{List – II} \\ \text{a.} & \text{Absurd} & \text{i.} & \text{Clearly impossible being con...