The five items: A, B, C, D, and E are pushed in a stack, one after the other…

2007

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

  1. A.

    A

  2. B.

    B

  3. C.

    C

  4. D.

    D

Attempted by 152 students.

Show answer & explanation

Correct answer: D

After pushing A, B, C, D and E, the stack top is E.

Popping four items gives E, D, C, B into the queue in that order.

Deleting two queue items gives E and D; pushing them back puts D on the top of the stack. The next popped item is D.

Explore the full course: Niacl Ao It Specialist