Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 4 : front = 4, rear = 3

Advertisement

Detailed Solution

सही उत्तर front = 4, rear = 3 है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

A circular queue of capacity 5 currently has front = 3 and rear = 1. After one dequeue followed by two enqueues, what are front and rear? / क्षमता 5 वाले वृत्तीय क्यू में वर्तमान में front = 3 और rear = 1 है। एक डिक्यू और फिर दो एनक्यू के बाद front और rear क्या होंगे?

1.
front = 4, rear = 2
2.
front = 0, rear = 3
3.
front = 3, rear = 2
4.
front = 4, rear = 3

Correct Answer: front = 4, rear = 3

Dequeue moves front to (3+1) mod 5 = 4; the two enqueues move rear from 1 to 2 and then to 3. / डिक्यू front को (3+1) mod 5 = 4 पर ले जाता है; दो एनक्यू rear को 1 से 2 और फिर 3 पर ले जाते हैं।

Downloaded from PrepSnap (prepsnap.in)