2D Array FRQ Patterns for AP CSA: How FRQ 4 Works (2026)

2D Array FRQ Patterns for AP CSA: How FRQ 4 Works

FRQ 4 on the AP CSA exam is always a 2D array problem. This page breaks down the recurring patterns, shows you how to earn maximum points, and gives you the step-by-step approach that works every time.

⏰ The AP CSA Exam is May 15, 2026 — Get the 4-Week Cram Kit →

📋 FRQ 4 Structure

FRQ 4 typically has 2 parts:

  1. Part (a): Process individual rows or columns (row sum, row max, count per row)
  2. Part (b): Use Part (a) results across the full matrix (find which row has the highest sum, compare columns)

Part (b) almost always calls Part (a). If you get Part (a) wrong, you can still earn full credit on Part (b) by calling Part (a) correctly and using its result properly.

🎓 AP Exam Tip

Even if your Part (a) is wrong, write Part (b) assuming Part (a) works. The rubric scores Part (b) independently. Call your Part (a) method and use its return value. You can earn 4-5 points on Part (b) with a broken Part (a).

🔍 The 4 Core Patterns

Pattern 1: Row-Based Processing

Process each row independently, often returning an array of results.

// Return array of row sums
public int[] allRowSums()
{
    int[] sums = new int[grid.length];
    for (int r = 0; r < grid.length; r++)
    {
        for (int c = 0; c < grid[r].length; c++)
        {
            sums[r] += grid[r][c];
        }
    }
    return sums;
}

Pattern 2: Find the Row/Column Meeting a Condition

Use row processing, then scan results for the best one.

// Which row has the largest sum?
public int rowWithMaxSum()
{
    int[] sums = allRowSums();  // call Part (a)
    int maxIdx = 0;
    for (int i = 1; i < sums.length; i++)
    {
        if (sums[i] > sums[maxIdx])
        {
            maxIdx = i;
        }
    }
    return maxIdx;
}

Pattern 3: Neighbor Checking

Check elements above, below, left, right. Must guard against going out of bounds.

// Is grid[r][c] greater than all its neighbors?
public boolean isLocalMax(int r, int c)
{
    int val = grid[r][c];
    if (r > 0 && grid[r-1][c] >= val) return false;
    if (r < grid.length-1 && grid[r+1][c] >= val) return false;
    if (c > 0 && grid[r][c-1] >= val) return false;
    if (c < grid[r].length-1 && grid[r][c+1] >= val) return false;
    return true;
}

Pattern 4: Counting Elements Meeting a Condition

// Count elements in a specific row that are above average
public int countAboveAvg(int row, double avg)
{
    int count = 0;
    for (int c = 0; c < grid[row].length; c++)
    {
        if (grid[row][c] > avg)
        {
            count++;
        }
    }
    return count;
}

🛠 Step-by-Step Approach

  1. Read Part (a) first. Identify what single-row or single-column operation it wants.
  2. Write the inner loop. This processes one row or column.
  3. Wrap in outer loop if needed. Some Part (a) methods only process one row (passed as parameter).
  4. Read Part (b). It almost certainly calls Part (a). Identify what it does with the result.
  5. Call Part (a) in Part (b). Do NOT copy-paste Part (a) code. Call the method.
⚠ Watch Out! The exam intentionally makes Part (a) a helper for Part (b). If you solve Part (b) without calling Part (a), you lose points even if your answer is correct. The rubric requires the method call.

💰 Scoring Rubric Tips

FRQ 4 rubrics consistently award points for:

  1. Correct loop bounds (1-2 pts) — grid.length for rows, grid[r].length for columns
  2. Accessing elements correctly (1 pt) — grid[r][c] with both indices
  3. Applying the condition (1-2 pts) — the if statement inside the loop
  4. Accumulating/returning the result (1 pt) — sum, count, or boolean
  5. Calling Part (a) in Part (b) (1 pt) — do not rewrite the logic

✏ Practice Questions

Score: 0 / 8
1. FRQ 4 Part (a) asks you to return the sum of a given row. Part (b) asks which row has the largest sum. In Part (b), you should:
2. When checking if grid[r][c] has a neighbor above it, which bounds check is correct?
3. A student writes Part (b) correctly but does NOT call the Part (a) method. Instead, they inline the same logic. On the rubric, they will:
4. Which expression gives the number of columns in a 2D array matrix?
5. Which of the following is true about the relationship between Part (a) and Part (b)?
I. Part (b) should call Part (a) as a helper method.
II. If Part (a) is wrong, Part (b) automatically gets zero points.
III. Part (b) typically operates on the results returned by Part (a).
6. A method should return true if ANY element in a given column equals a target value. What is the correct return placement?
7. Given a 5x3 matrix, how many times does the inner loop body execute during a complete row-major traversal?
8. FRQ 4 Part (a) returns an int[] with the sum of each row. Part (b) returns the index of the row with the smallest sum. If two rows tie, it returns the smaller index. What is the correct comparison in Part (b)?

❓ Frequently Asked Questions

Is FRQ 4 always a 2D array problem?

Yes. On the 2026 AP CSA exam, FRQ 4 always involves a 2D array. The problem typically requires nested loop traversal, processing rows or columns, and applying conditions to elements.

How is FRQ 4 scored?

FRQ 4 is worth 9 points. Points are awarded for correct loop bounds, accessing elements properly, applying the condition, accumulating or modifying values, and returning the correct result. Partial credit is common.

What patterns show up most on FRQ 4?

The most common patterns are: processing each row independently (like finding the row with the highest sum), checking neighbors, counting elements meeting a condition, and modifying a subregion of the matrix.

About the Author: Tanner Crow has 11+ years of AP Computer Science teaching experience, 1,845+ verified tutoring hours, and a 5.0 rating. His students score 5s at over double the national rate. Book a tutoring session →

Get in Touch

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.

🏫 Welcome, fellow educator!

I offer curriculum resources, practice materials, and study guides designed for AP CS teachers. Let me know what you're looking for — whether it's classroom materials, a guest speaker, or Teachers Pay Teachers resources.

Email

tanner@apcsexamprep.com

📚

Courses

AP CSA, CSP, & Cybersecurity

Response Time

Within 24 hours

Prefer email? Reach me directly at tanner@apcsexamprep.com