
Arrays are one of the most important and frequently tested topics on the AP Computer Science A (AP CSA) exam.
They appear in both MCQs and FRQs and form the foundation for looping, indexing, searching, and algorithmic logic.
This page contains exam-style FRQs focused only on Arrays, written to match AP CSA difficulty and format.
Why Practice Arrays FRQs?
Arrays help build strong understanding of:
- Looping and iteration
- Index-based access
- Searching and counting
- Conditional logic
- Algorithmic thinking
- Common patterns like max/min, streaks, cumulative sum
Strong array logic leads to better performance on many FRQs.
How to Use This Page
- Try solving the question before checking the answer
- Compare your code with the model solution
- Read the “Common Mistakes” section for each problem
- Redo the problem to improve technique
FRQ 1 — Count Values Above a Threshold (Easy)
Problem:
Write a method countAbove(int[] arr, int limit) that returns how many elements in arr are strictly greater than limit.
Example:
arr = [30, 35, 28, 40], limit = 30 → output = 2
Approach
- Loop through all elements
- Use a counter
- Compare each value with the limit
Java Solution
public int countAbove(int[] arr, int limit) {
int count = 0;
for (int v : arr) {
if (v > limit) {
count++;
}
}
return count;
}Common Mistakes
- Using >= instead of >
- Forgetting that empty arrays return 0 automatically
FRQ 2 — First Index of Even Number (Easy)
Problem
Write firstEven(int[] nums) that returns the index of the first even number.
If none exist, return -1.
Example:
[3, 5, 8, 9] → returns 2
Approach
- Loop from start
- Check if each element is even
- Return index immediately
Java Solution
public int firstEven(int[] nums) {
for (int i = 0; i < nums.length; i++) {
if (nums[i] % 2 == 0) {
return i;
}
}
return -1;
}
Common Mistakes
- Returning the value instead of the index
- Using <= nums.length in the loop condition
FRQ 3 — Running Total Array (Medium)
Problem
Given an array, return a new array where each element is the sum of all previous elements including itself.
Example:
[2, 3, 5] → [2, 5, 10]
Approach
- Use a running sum variable
- Build a new array for output
Java Solution
public int[] runningTotal(int[] values) {
int[] result = new int[values.length];
int sum = 0;
for (int i = 0; i < values.length; i++) {
sum += values[i];
result[i] = sum;
}
return result;
}
Common Mistakes
- Modifying the original array instead of returning a new one
- Forgetting that empty arrays return empty arrays
FRQ 4 — Replace Negatives With Zero (Medium)
Problem
Write fixNegatives(int[] arr) to replace every negative value with 0.
Modify the array directly (no return value needed).
Java Solution
public void fixNegatives(int[] arr) {
for (int i = 0; i < arr.length; i++) {
if (arr[i] < 0) {
arr[i] = 0;
}
}
}
Common Mistakes
- Trying to remove negative elements (arrays can’t shrink)
- Using enhanced for-loop and trying to change values (it won’t modify arr)
FRQ 5 — Longest Increasing Streak (Hard)
Problem
Return the length of the longest strictly increasing streak in an array.
Example:
[3, 4, 5, 2, 3, 4, 6] → 4 (streak is 2, 3, 4, 6)
Approach
- Handle edge case of empty array
- Use two counters: current and longest
- Compare current element with previous one
Java Solution
public int longestIncreasingStreak(int[] arr) {
if (arr.length == 0) return 0;
int longest = 1;
int current = 1;
for (int i = 1; i < arr.length; i++) {
if (arr[i] > arr[i - 1]) {
current++;
} else {
longest = Math.max(longest, current);
current = 1;
}
}
return Math.max(longest, current);
}
Common Mistakes
- Resetting to 0 instead of 1
- Not returning 1 for single-element arrays
Next FRQ Topics
- ArrayList FRQ Practice
- Strings FRQ Practice
- Classes & Objects FRQ Practice
- 2D Arrays FRQ Practice
- Mixed Topic FRQs
Need Help With AP CSA?
I provide 1-on-1 AP Computer Science tutoring via Zoom with FRQ practice, MCQs, code debugging and exam preparation.
WhatsApp: +91 9853166385
Book Demo: javatutoronline.com/contact-us/