Matrix Quiz
Editorial
16 questions across the two Matrix lessons and the section's problems: cells as coordinates and as one index, neighbours and bounds, the diagonals and the spiral, the transpose and Sudoku's boxes; then turning a matrix in place, Set Matrix Zeroes' marks and Game of Life's two bits. Pick an answer to see whether it's right and why. Nothing is saved, so you can take it again.
If one trips you up, its lesson is Introduction to Matrices or Changing a Matrix in Place.
Quiz
1 / 16Multiple choice
A 6 × 11 matrix is stored row after row in one flat array, counting from 0. At what index is cell (4, 9)?
Multiple choice
In a 5 × 6 grid, how many cells have all eight neighbours inside the grid?
Multiple choice
In Python, a neighbour check written as
if nr < rows and nc < cols: lets r − 1 = −1 through. On a 4 × 4 grid, which cell does grid[-1][-1] read?Multiple choice
Do cells (2, 5) and (4, 3) lie on one diagonal?
Multiple choice
How many diagonals running from bottom-left to top-right does a 4 × 9 matrix have?
Multiple choice
Diagonal Traverse on a 4 × 5 matrix: the walk reaches (0, 4), the top-right corner, going up. Which cell does it visit next?
Multiple choice
Spiral Matrix on a 3 × 5 matrix: which cell does the spiral read last?
Multiple choice
Transpose Matrix on a 3 × 5 matrix: what shape comes out, and where does the value at (1, 4) go?
Multiple choice
Valid Sudoku numbers the 3 × 3 boxes 0 to 8 by rows. Which box holds cell (7, 4)?
Multiple choice
A 7 × 7 matrix is turned a quarter clockwise twice. Where does the value at (2, 5) end up?
Multiple choice
Which two steps turn a square matrix a quarter turn counter-clockwise?
Multiple choice
Rotating a 7 × 7 matrix in place, layer by layer, four cells at a time: how many cycles of four does it turn?
Multiple choice
Set Matrix Zeroes on [[5, 0, 7], [2, 3, 4], [6, 1, 0]]: which values keep their place?
Multiple choice
Set Matrix Zeroes marks in row 0 and column 0, with (0, 0) marking both row 0 and column 0 and no separate flag. On [[1, 2, 3], [4, 5, 6], [0, 8, 9]], how many cells end up 0 that should keep their value?
Multiple choice
Game of Life on [[0, 0, 0], [1, 0, 1], [0, 1, 0]]: what's the next board?
Multiple choice
Two-bit Game of Life on [[0, 1, 1], [1, 1, 0], [0, 0, 0]]: after the first pass, before the shift, what does row 0 hold?