← 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?
- A.index 7
- B.index 2
- C.index 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 →