AP CSA FRQ Guide
2025 FRQ 4: SumOrSameGame
Write a constructor that creates and fills a 2D integer puzzle with random values from 1 through 9. Then write a method that searches for a valid pair in the same row or a later row, clears both elements, and reports whether a pair was found.
Skills Tested
What this FRQ is really practicing
Treat these skills as the study checklist. If any tag feels shaky, review that topic before attempting the full written response.
Starter Approach
How to begin without copying a solution
- 1Part A: create the puzzle 2D array using the requested row and column counts.
- 2Fill every cell with an equally likely random integer from 1 through 9.
- 3Part B: search row and later rows for another element that is equal to the selected value or sums with it to 10.
- 4If a valid pair is found, set both cells to 0 and return true; otherwise leave the puzzle unchanged and return false.
Write a first attempt before revealing any solution outline. Most AP CSA FRQ progress comes from tracing your own code and finding the missing case.
Common Mistakes
Mistakes to watch for while writing
Self Check
Review questions before you submit
Includes the SumOrSameGame constructor with row and column parameters.
The constructor should receive numRows and numCols.
Creates puzzle as a 2D int array with the requested dimensions.
Use new int[numRows][numCols].
Uses nested loops to visit rows and columns.
Every puzzle cell needs to be assigned.
Generates values from 1 through 9.
A common expression is (int)(Math.random() * 9) + 1.
Defines clearPair with the correct boolean return type.
The method should return true or false.
Stores or reuses the selected puzzle value.
Keep track of puzzle[row][col] before clearing anything.
Searches only the given row and later rows.
The outer loop should start at row, not 0.
Avoids pairing the selected cell with itself.
Check that the candidate row/column is not the original row/column.
Practice Links
