in DS recategorized
3,210 views
1 vote
1 vote

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$
in DS recategorized
3.2k views

2 Comments

0
0
i think B is the ansewer
0
0

3 Answers

2 votes
2 votes
Best answer

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

selected by
1 vote
1 vote

Option B

1 vote
1 vote

Option is B

Answer:

Related questions