Parallel arrays are two or more arrays of the same length where corresponding indices represent related data. Index 0 in array A goes with index 0 in array B, and so on.
Structure
String[] names = {"Alice", "Bob", "Carol", "Dave"};
int[] scores = {92, 78, 85, 91};
// names[0] = "Alice" and scores[0] = 92 are related
// names[1] = "Bob" and scores[1] = 78 are related
Common Operations
// Print all name-score pairs
for (int i = 0; i < names.length; i++) {
System.out.println(names[i] + ": " + scores[i]);
}
// Find the name with the highest score
int maxIdx = 0;
for (int i = 1; i < scores.length; i++) {
if (scores[i] > scores[maxIdx]) {
maxIdx = i;
}
}
System.out.println("Top scorer: " + names[maxIdx]);
Key Pattern: Track the index of the max/min, not just the value, so you can look up the corresponding element in the other array.
📝 Practice Question 1
Parallel arrays names (String[]) and ages (int[]) each have 5 elements. Which code correctly prints the name of the oldest person?
✅ Exam Tip: Parallel array problems almost always require tracking an index, not a value. When asked to find a name/label associated with a max or min, initialize int maxIdx = 0 and update it — never just track the numeric maximum.
Whether you're a student, parent, or teacher — I'd love to hear from you.
Just want free AP CS resources?
Enter your email below and check the subscribe box — no message needed.
Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.
Typically responds within 24 hours
✓
Message Sent!
Thanks for reaching out. I'll get back to you within 24 hours.
Choosing a selection results in a full page refresh.
Opens in a new window.
4. The correct popup fires automatically based on the current page URL:
- AP CSP pages -> CSP popup
- AP Cyber pages -> Cybersecurity popup
- All other pages -> AP CSA popup (already live, but improved version here)
Klaviyo API Key: XbXGVC
Klaviyo List ID: UpYKgr (add all to same list for now; tag by course)
============================================================ -->
AP Computer Science A
Free Daily Practice Questions + Exam Tips
Join 134+ AP CSA students getting better scores with daily practice
✓Daily MCQ + FRQ practice delivered free
✓54.5% of Tanner’s students score 5s (national avg: 25.5%)
✓Exam week survival guide — free for subscribers
✓
You’re in!
Check your email for your first practice question.