Skills101
← All practice quizzes

Quiz: Matrix Traversal

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Walk a 2D array every way interviews ask — row by row, column by column, in a spiral, along diagonals — rotate it by 90°, and move to neighbours safely with direction arrays.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What does this print?

    m = [[1, 2], [3, 4], [5, 6]]
    print(len(m), len(m[0]), m[2][1])
    
  2. Question 2

    What is the spiral order of [[1, 2, 3], [4, 5, 6], [7, 8, 9]]?

  3. Question 3

    How do you rotate a square matrix 90° clockwise in place?

  4. Question 4

    Cells (0, 2), (1, 1) and (2, 0) of a 3×3 matrix all have the same:

  5. Question 5

    What does this print?

    grid = [[0] * 3] * 2
    grid[0][0] = 9
    print(grid)
    
🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →