Data Structures & AlgorithmsVery hardTCS NQT · Infosys

In the sequence of queue operations enqueue 5, enqueue 3, dequeue, enqueue 8, dequeue, dequeue, enqueue 1, what is the value at the front of the queue afterwards (the queue is non-empty)?

  1. A. 2
  2. B. 1
  3. C. {C+5}
  4. D. 4

Correct answer: B. 1

After the operations, only 1 remains in the queue, so the front is 1. Stack order would give a different element.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic