LearnFrenzy
Sign in Take a free test

Data Structures in Java · Data Structures in Java MCQ · Question 16

Next tail index in a circular queue Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 16 Back to Exercise

In an array-based circular queue of size capacity, how is the next tail index computed?

  • A tail + 1
  • B (tail + 1) % capacity Correct
  • C tail * 2
  • D (tail - 1) % capacity
Correct Answer: Option B

The modulo wraps the index from the last slot back to 0.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links