Question

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

Option 4 : 4 / 4

Advertisement

Detailed Solution

सही उत्तर 4 / 4 है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

A circular queue uses an array of capacity 5 (indices 0–4). If front = 3 and rear = 1 (rear points to the last inserted element), how many elements are in the queue? / एक वृत्तीय कतार क्षमता 5 वाली ऐरे (इंडेक्स 0–4) उपयोग करती है। यदि front = 3 और rear = 1 (rear अंतिम प्रविष्ट तत्व की ओर इंगित करता है), तो कतार में कितने तत्व हैं?

1.
2 / 2
2.
3 / 3
3.
5 / 5
4.
4 / 4

Correct Answer: 4 / 4

The elements occupy indices 3, 4, 0, 1 — four elements. By formula: (rear − front + capacity) mod capacity + 1 = (1 − 3 + 5) mod 5 + 1 = 4. / तत्व इंडेक्स 3, 4, 0, 1 पर हैं — चार तत्व। सूत्र से: (rear − front + capacity) mod capacity + 1 = (1 − 3 + 5) mod 5 + 1 = 4।

Downloaded from PrepSnap (prepsnap.in)