Google News
logo
Data Structures - Quiz(MCQ)
Which one of the following is the correct way to increment the rear end in a circular queue?
A)
rear =rear+1
B)
(rear % max) + 1
C)
(rear+1) % max
D)
None of the above

Correct Answer :   (rear+1) % max


Explanation : It ensures that the rear will have the value from 0 to max-1; if the rear end points to the last position, and we increment the rear end using (rear+1) % max, then rear will point to the first position in the queue.

Advertisement