Which statement is true about condition of overflow in the circular Queue? I.…

2021

Which statement is true about condition of overflow in the circular Queue? I. Front = 1 and Rear = N II. Front = Rear + 1

Answer: C. Both I and IIConcept: An array-based circular queue stores elements in a fixed-size array of N slots addressed 1..N, and uses two pointers, Front and Rear, to track the…

  1. A.

    Only I

  2. B.

    Only II

  3. C.

    Both I and II

  4. D.

    Neither I nor II

Attempted by 944 students.

Show answer & explanation

Correct answer: C

Concept: An array-based circular queue stores elements in a fixed-size array of N slots addressed 1..N, and uses two pointers, Front and Rear, to track the occupied range. Because Rear wraps from N back to 1 after the last slot, checking whether the queue is full needs two separate tests, not one: (a) the very first time the queue fills up, it is filled straight through without any wrap-around, so Front stays at 1 while Rear advances all the way to N; and (b) after at least one wrap-around has already happened, the queue becomes full exactly when Rear lands one slot behind Front, i.e. Front = Rear + 1, since inserting one more element would make Rear catch up to and pass Front. The standard insertion algorithm for a circular queue therefore raises overflow when EITHER Front = 1 and Rear = N, OR Front = Rear + 1.

Application: Statement I (Front = 1 and Rear = N) is exactly case (a) above -- it is a genuine full/overflow state, so it is true. Statement II (Front = Rear + 1) is exactly case (b) above -- it is also a genuine full/overflow state, so it is also true. Since both individually describe valid overflow conditions, the answer is that both statements are true.

Cross-check: Trace a queue of size N = 4 starting empty (Front = 1). Inserting 4 elements one after another without any removal advances Rear to 4 while Front remains 1 -- this matches Front = 1 and Rear = N, confirming statement I. Now suppose 2 elements are removed (Front becomes 3) and then elements are inserted until the array wraps around; the queue becomes full again when Rear reaches 2, i.e. one position behind Front (3), so Front = Rear + 1 -- confirming statement II. Both traces land on a genuinely full queue, so neither condition is a false positive.

Explore the full course: Rssb Basic Computer Instructor

Loading lesson…