AP CSA FRQ Guide
2019 FRQ 4: LightBoard
Write two LightBoard methods. The constructor fills a 2D boolean grid so each light is on with a given probability. The evaluation method counts on-lights in a column and decides whether a specific light should be on in the next step.
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
- 1Constructor: create the lights array with numRows rows and numCols columns.
- 2Use Math.random so each cell is true with probability 0.40 and false otherwise.
- 3Part B: count how many lights in the specified column are currently on.
- 4If lights[row][col] is on, return false when the column on-count is even, otherwise true.
- 5If lights[row][col] is off, return true when the column on-count is divisible by 3, otherwise 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
Defines the LightBoard constructor with row and column counts.
The constructor receives numRows and numCols.
Creates the lights 2D boolean array using numRows and numCols.
Use new boolean[numRows][numCols].
Uses nested loops to initialize every cell.
Each light should receive its own random result.
Uses Math.random to generate the on/off state.
Math.random() < 0.40 gives true about 40 percent of the time.
Uses the 0.40 probability threshold.
Each light should be on with probability 0.40.
Defines evaluateLight with boolean return type and row/col parameters.
Part B returns the next-state decision for one light.
Traverses the specified column across all rows.
Loop over row indexes and keep col fixed.
Counts lights that are currently on in the specified column.
Increment the count for true values.
Practice Links
