# MCQ IN COMPUTER SCIENCE & ENGINEERING

## COMPUTER SCIENCE AND ENGINEERING

### DATA STRUCTURES

 Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Why does a circular queue use the MOD function?
 A to check how many items are in the queue B to calculate the next index to use when inserting an item into the queue C to check if the queue is full D to check if the queue is empty
Explanation:

Detailed explanation-1: -The modulo operation is also used in circular array. When an array index modulo (or mod) the array length, the index that is larger than length will wrap around to the beginning of the array. Therefore an array becomes a circular array. Check here to see how it works to create a circular queue.

Detailed explanation-2: -The dequeue() operation is accountable for deleting the data element from the front node of a queue. While implementing this operation, you will first check if the queue is empty as you cannot delete the element if there is no element in a queue.

Detailed explanation-3: -enQueue(value) This function is used to insert an element into the circular queue. In a circular queue, the new element is always inserted at Rear position. Check whether queue is Full – Check ((rear == SIZE-1 && front == 0) || (rear == front-1)). If it is full then display Queue is full.

Detailed explanation-4: -A circular queue will be full when Front =-1 and Rear = max – 1.

There is 1 question to complete.