Grade 12 Computer Science · Two-dimensional arrays
Summary practice — grids
Ten exercises on everything the unit taught.
From one picture: all the rules of the grid
Two lengths, two orders of traversal, rows that are not equal, a level of accumulation and neighbors at the edge. These exercises check whether, when you see two pairs of square brackets, you now think of a row that is an array, and not of a table.
This unit built everything from one picture: there is no grid, there is an array whose every item is an array. From that come the two lengths, the two orders of traversal, the possibility of an uneven shape, and most of the mistakes. The patterns themselves are exactly the ones you already knew.
Review — a safe traversal and an accumulation per row
- The outer loop over rows.
- Initialise for each row at its start.
- Ask each row its length.
- And keep the result at its end.