In a queue if value of front pointer is equal to rear pointer then queue

2013

In a queue if value of front pointer is equal to rear pointer then queue

  1. A.

    Is empty

  2. B.

    Is full

  3. C.

    Has one element

  4. D.

    May have one element

Attempted by 22 students.

Show answer & explanation

Correct answer: D

Concept

A queue is a linear, first-in-first-out structure managed by two markers: a front pointer that tracks where elements leave and a rear pointer that tracks where the most recent element was added. The relationship between these two markers reports the queue's state, but the exact meaning of front equal to rear is implementation-dependent — different initialisation and update conventions assign it different states.

Application

Trace what front equal to rear can correspond to across common array conventions:

  • Convention with front and rear both starting at 0: after a single insertion the rear stays aligned with the front, so the markers being equal corresponds to exactly one stored element.

  • Convention where rear advances on insert while front stays put: an empty queue and a one-element queue can both leave the two markers coinciding at the same index depending on the order of the operations performed.

Because the equality does not pin down a single guaranteed count — it can arise with one element, and under some conventions with none — the only statement that is always defensible is the qualified one: the queue may hold one element.

Contrast

  • The claim that the queue is necessarily empty is too strong — the equal markers frequently sit on a stored element rather than on no element at all.

  • The claim that the queue is full describes the wrap-around or capacity condition (rear adjacent to front), not the markers being equal.

  • The unconditional claim of exactly one element is overstated, since the same equality can describe an empty queue under a different update rule; the qualifier may is what makes the statement universally safe.

Hence the equality of the front and rear markers, read across conventions, supports only the qualified conclusion that the queue may have one element.

Explore the full course: Btsc Lab Assistant

Loading lesson…