Skip to main contentSkip to solution

Select the correct value of 'front' and 'rear' in the given queue after performing the listed operations. Consider size of the Queue as 10.

Queue:

12345

Operation:

Enqueue(6), Dequeue(), Enqueue(7), Dequeue(), Dequeue()

Solution

✅ Correct Option: 2

A queue is first in, first out: Enqueue adds at the rear, and Dequeue removes from the front.

OperationQueue after itFrontRear
Start1, 2, 3, 4, 515
Enqueue(6)1, 2, 3, 4, 5, 616
Dequeue()2, 3, 4, 5, 626
Enqueue(7)2, 3, 4, 5, 6, 727
Dequeue()3, 4, 5, 6, 737
Dequeue()4, 5, 6, 747

Option 1: front=3 is the value after only two Dequeue() operations, but there are three.

Option 3: rear=6 ignores Enqueue(7).

Option 4: front=2 is the value after only one Dequeue().

Keyboard Shortcuts

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