Question 83Asked in BPSC TRE 1.0 (2023) Computer Science Class 11-12

If circular queue is implemented using array having size MAX_SIZE in which array index starts with 0, front points to the first element in the queue, and…

If circular queue is implemented using array having size MAX_SIZE in which array index starts with 0, front points to the first element in the queue, and rear points to the last element in the queue. Which one of the following conditions is used to specify that the circular queue is empty?
  1. AFront = rear = −1
  2. BFront = rear = 0
  3. CFront = rear + 1
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (A) Front = rear = −1

Explanation

With this convention, front and rear start at −1. Front = rear = −1 means the queue is empty, and front = rear ≥ 0 means it holds one element.

From BPSC TRE 1.0 (2023) Computer Science Class 11-12 — Previous Year Paper

This is question 83 of BPSC TRE 1.0 (2023) Computer Science Class 11-12 — Previous Year Paper. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.