Skip to main contentSkip to solution

What will be the status of QUEUE after the end of following operations?

enqueue(34)

enqueue(54)

dequeue( )

enqueue(12)

enqueue(15)

dequeue( )

enqueue(71)

Solution

✅ Correct Option: 3

A queue is FIFO (first in, first out): enqueue adds at the rear and dequeue removes from the front.

OperationQueue (front to rear)
enqueue(34)34
enqueue(54)34, 54
dequeue( )54
enqueue(12)54, 12
enqueue(15)54, 12, 15
dequeue( )12, 15
enqueue(71)12, 15, 71

Options 1 and 2: 34 entered first, so the first dequeue removes it.

Option 4: 54 is removed by the second dequeue, and 15 is still in the queue.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question