Questions: Queue ADT: Circular Array and Linked-List Implementations

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A naive array-based queue always uses index 0 as the front and shifts all remaining elements left on every dequeue. After 10,000 enqueue-then-dequeue operations on a queue that never holds more than 5 elements at a time, what is the overall time complexity behavior?

AO(n) per dequeue due to shifting, where n is the current queue size — even if the queue is small, each shift still occurs
BO(1) per operation because the queue size stays bounded by 5
CO(log n) because the array shrinks as elements are removed
DO(n) per enqueue only; dequeue is always O(1)
Question 2 Multiple Choice

A circular array queue has capacity 5. The front index is 3 and the rear index is 1 (elements wrap around the array end). What index should the next enqueue write to, and how is it computed?

AIndex 2, computed as (rear + 1) % capacity = (1 + 1) % 5
BIndex 2, but only if there is a gap between rear and front — otherwise the queue must resize first
CIndex 6, by extending the array past its current end
DIndex 0, because rear has passed the midpoint of the array
Question 3 True / False

In a circular array queue, both enqueue and dequeue run in O(1) time.

TTrue
FFalse
Question 4 True / False

A linked-list queue is typically more efficient than a circular array queue because it avoids the need for resizing.

TTrue
FFalse
Question 5 Short Answer

Why does a circular array solve the performance problem of a naive array-based queue, and what is the single conceptual shift that makes it work?

Think about your answer, then reveal below.