Which of the following conditions correctly check the underflow condition in a…

2017

Which of the following conditions correctly check the underflow condition in a queue?

Answer: A. front = -1The correct option is A. In a standard array-based queue implementation, an underflow condition occurs when trying to dequeue from an empty queue. Initially,…

  1. A.

    front = -1

  2. B.

    rear = 1

  3. C.

    rear = size

  4. D.

    front = size

Attempted by 480 students.

Show answer & explanation

Correct answer: A

The correct option is A. In a standard array-based queue implementation, an underflow condition occurs when trying to dequeue from an empty queue. Initially, when the queue has no elements, the front (and rear) pointers are traditionally initialized to -1. Therefore, front == -1 signifies underflow.

Explore the full course: Btsc Lab Assistant

Loading lesson…