🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Queues and Deques: all 13 questions

Quiz: Queues and Deques · Question 3 of 13

In a circular queue of capacity 5 with head = 3 and size = 4, where does the next element go?

In a circular queue of capacity 5 with head = 3 and size = 4, where does the next element go?

  1. A.index 7
  2. B.index 2
  3. C.index 4
  4. D.it is full
Answer & explanation

Correct answer: index 2

(head + size) % capacity = (3 + 4) % 5 = 2.

Can you get the rest right without peeking?

Take the timed Quiz: Queues and Deques quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →