GateAI
Linear Structures, Trees and Heaps

GATE CSE 2012 · Q35

MCQ2 marksEasy

Time

Suppose a circular queue of capacity (n−1)(n - 1) elements is implemented with an array of nn elements. Assume that the insertion and deletion operations are carried out using REAR and FRONT as array index variables, respectively. Initially, REAR=FRONT=0\text{REAR} = \text{FRONT} = 0. The conditions to detect queue full and queue empty are

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: A) full: (REAR+1) mod n == FRONT empty: REAR == FRONT

Linear Structures, Trees and Heaps

In a circular queue of size nn designed to store up to (n−1)(n - 1) elements:

  1. Queue Empty Condition: Initially, both FRONT and REAR point to the same index (0). The queue is empty whenever REAR == FRONT.

  2. Queue Full Condition: To prevent the full condition from being indistinguishable from the empty condition, one position is kept empty. An element is inserted at (REAR + 1) mod n. Therefore, the queue is considered full when the next insertion position coincides with FRONT:

    (REAR+1) mod n==FRONT(\text{REAR} + 1) \bmod n == \text{FRONT}

Hence, the correct choice is (A).

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Linear Structures, Trees and Heaps previous year question is Q35 of the GATE CSE 2012 paper. Find more GATE CSE PYQs on Linear Structures, Trees and Heaps in Programming and Data Structures, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Linear Structures, Trees and Heaps PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Linear Structures, Trees and Heaps in GATE CSE

Linear Structures, Trees and Heaps has 14 GATE CSE PYQs across 12 papers from 2012 to 2026. 4 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2012.

How GATE tests Linear Structures, Trees and Heaps

More from GATE CSE 2012

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2012 · Q35 · MCQ

Suppose a circular queue of capacity (n - 1) elements is implemented with an array of n elements. Assume that the insertion and deletion operations are carried out using REAR and FRONT as array index variables, respectively. Initially, REAR = FRONT = 0. The conditions to detect queue full and queue empty are

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.