AP CSA FRQ Guide
2018 FRQ 4: ArrayTester
Write two static methods for array analysis. The first extracts a column from a 2D array. The second determines whether a square array is Latin by using the first row, column extraction, and provided helper methods.
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 a one-dimensional int array with one element for each row of arr2D.
- 2Copy arr2D[row][c] into the matching result position without changing arr2D.
- 3Part B: reject the square if the first row contains duplicates.
- 4Use hasAllValues to verify every row contains all values from the first row.
- 5Use getColumn and hasAllValues to verify every column contains all values from the first row.
- 6Return true only after all row and column checks pass.
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
Defines getColumn as a static method returning int[].
Part A returns a one-dimensional array.
Creates the result array using the number of rows.
The extracted column has one value per row.
Loops over every row in arr2D.
Use arr2D.length as the row count.
Copies arr2D[row][c] into the result array.
Keep c fixed and vary the row index.
Returns the extracted column array.
Return the newly created array after the loop.
Defines isLatin as a static boolean method.
Part B returns whether the square satisfies the Latin-square rules.
Rejects duplicate values in the first row.
Use containsDuplicates on square[0].
Checks every row against the first row using hasAllValues.
Each row must contain the same values as the first row.
Practice Links
