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 variable respectively. Initially, REAR = FRONT = 0. The conditions to detect queue empty and queue full are

This question was previously asked in
UGC NET Computer Science (Paper 2) 17 June 2023 Official Paper
View all UGC NET Papers >
  1. EMPTY : REAR == FRONT

    FULL : (REAR + 1) mod n == FRONT

  2. EMPTY : (FRONT + 1) mod n == REAR

    FULL : (REAR + 1) mod n == FRONT

  3. EMPTY (REAR + 1) mod n == FRONT

    FULL : REAR == FRONT

  4. EMPTY : REAR == FRONT

    FULL : (FRONT + 1) mod n == REAR

Answer (Detailed Solution Below)

Option 1 :

EMPTY : REAR == FRONT

FULL : (REAR + 1) mod n == FRONT

Free
UGC NET Paper 1: Held on 21st August 2024 Shift 1
10.8 K Users
50 Questions 100 Marks 60 Mins

Detailed Solution

Download Solution PDF

The Correct answer is  EMPTY : REAR == FRONT and FULL : (REAR + 1) mod n == FRONT

Key Points A circular queue is a queue whose last position is connected back to the first position.

F1 SSC Priya 6-2-24 D7

  • ENQUEUE – It is the operation to insert elements into the queue.
  • DEQUEUE – It is the operation to delete elements from the queue.

After inserting an element in the last position, the next element again gets inserted into the first position.

EXPLANATION:

  • Given, Rear = Front = 0
  • Here, the Rear is used to insert elements & the front is used to delete elements.
  • To check full condition in queue:
    • (Rear + 1) % n == Front
  • Example: Consider queue is full that means Rear = 6, front = 0, n = 7
    • (6+1) % 7 = 7 % 7 = 0
  • To check empty condition in queue:
    • Rear == Front
  • Example: Consider queue is empty that means Rear = 0, front = 0, n = 7
    • Rear = Front = 0

Hence, the correct answer is “option 1”.

Latest UGC NET Updates

Last updated on Jun 12, 2025

-> The UGC NET June 2025 exam will be conducted from 25th to 29th June 2025.

-> The UGC-NET exam takes place for 85 subjects, to determine the eligibility for 'Junior Research Fellowship’ and ‘Assistant Professor’ posts, as well as for PhD. admissions.

-> The exam is conducted bi-annually - in June and December cycles.

-> The exam comprises two papers - Paper I and Paper II. Paper I consists of 50 questions and Paper II consists of 100 questions. 

-> The candidates who are preparing for the exam can check the UGC NET Previous Year Papers and UGC NET Test Series to boost their preparations.

More Queue Questions

Get Free Access Now
Hot Links: teen patti real cash apk teen patti game paisa wala teen patti master king teen patti wealth