AP CSA FRQ Guide
2017 FRQ 4: Successors
Search a 2D array for values, return Position objects, and build a same-sized array that stores successor positions.
2D Array Position Mapping22 minute target2D arraysstatic methodsobjectssearch
Skills Tested
What this FRQ is really practicing
2D arraysstatic methodsobjectssearch
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: traverse every row and column and return a Position for the matching value.
- 2Part B: create a Position[][] and fill each cell with the location of the next integer value.
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
Returning null inside the inner loop after only one failed comparison.
Creating a result array with swapped dimensions.
Storing the current value position instead of the successor value position.
Self Check
Review questions before you submit
Traverses rows and columns of the 2D array.
Use nested loops with intArr.length and intArr[row].length.
Creates Position objects with row and column.
Return a Position, not the array value.
Returns null when a value is not found.
Do this after the full search, not during the first failed comparison.
Looks up the position of each value plus one.
Each cell in the result stores the position of the successor value.
Practice Links
