Computer Science EngineeringVery hard

A queue starts empty. Operations: enqueue 1, enqueue 2, enqueue 3, dequeue, enqueue 4, dequeue, enqueue 5. Which element is now at the front?

  1. A. 2
  2. B. 3
  3. C. 4
  4. D. 5

Correct answer: B. 3

After two dequeues the elements 1 and 2 are gone, leaving 3, 4, 5 with 3 at the front.

More Algorithms, Data Structures & Programming (ISRO CS) questions

Exams that ask this topic