Community resourceWorksheet

OCR H446 1.4.2 Multidimensional structures in programs

Part 2 of 14 · H446 1.4.2 · Data structures

Dimensions are indexing decisions, not a measure of how realistic a model looks, and H446 1.4.2 asks students to keep every one of them meaningful. Working from a venue stored by floor, row and seat, this worksheet teaches confident indexing and ordered traversal of one, two and three-dimensional structures.

Students will:

  • interpret an index into one, two and three-dimensional structures and say what each position selects
  • state the coordinates visited by a row-major traversal and the value stored at a given index
  • write nested loops that count matching elements in a 3D nested list of unstated size
  • explain when a list of records is clearer than a 2D array whose columns carry meaning
  • recall the naming of layers, rows and columns from memory in a closed-book check

Inside: 7 explanation cells, 1 multiple-choice question, 1 fill-in-the-blanks cell, 2 written answers and 2 Python tasks. 17 marks, about 40 to 50 minutes.

Series: H446 1.4.2 · Data structures, part 2 of 14.

Shared by Coding PathwayVerified teacher

  • 13 cells
  • About 45 minutes
  • CC BY-SA 4.0
  • Shared 31 Aug 2026
  • Updated 15 Sept 2026

Preview

The whole resource, exactly as a class sees it. Answers and marking are held back.

Multidimensional structures in programs

A venue model stores values by floor, row and seat. Dimensions are independent indexing decisions, not a measure of visual realism.

By the end, you will be able to

  • interpret 1D, 2D and 3D indexes;
  • traverse every element in a defined order;
  • update nested structures safely;
  • combine arrays/lists with records for meaningful data.

Reactivate: OCR arrays are zero-based in Appendix 5d.

Name every index

Indexing one, two and three dimensionslayer 0layer 1layer 2Xvenue[layer][row][column]: write the meaning of every index before traversing.

A 1D array uses one index, a 2D array two, and a 3D array three. For venue[layer][row][column], venue[2][1][3] means layer 2, row 1, column 3. Write meanings before values to prevent swapped indexes.

Worked traversal

To visit a 3 × 2 seat grid, the outer loop chooses a row and the inner loop visits every column in that row. Six items are visited. For a 3D structure, add an outer layer loop.

Trace loop counters and one selected value before running code. The number of nested data-dependent loops often reflects the dimensions being traversed.

Worked example
seats = [["free", "used", "free"], ["used", "free", "free"]]
free_count = 0
for row in range(len(seats)):
    for column in range(len(seats[row])):
        if seats[row][column] == "free":
            free_count += 1
print(free_count)
Multiple choice1 mark

For venue[layer][row][column], what does venue[1][0][2] select?

  • ALayer 2, row 0, column 1
  • BRow 1 only
  • CThree adjacent values
  • DLayer 1, row 0, column 2

Guided practice

On a 2 × 3 grid, list visited coordinates for row-major traversal. Then change one coordinate and predict the free count. Keep coordinate, stored value and loop order separate.

Written answer4 marks

For grid = [[4, 1, 3], [2, 5, 0]], state the row-major visit order, the value at grid[1][1], and one loop structure that visits every item.

Use zero-based indexes.

Students type their answer here.

Independent transfer: occupancy cube

Implement count_status(cube, target) for a 3D nested Python list. Return how many elements equal target. Do not assume fixed dimensions.

Coding task5 marks
def count_status(cube, target):
    count = 0
    for layer in cube:
        for row in layer:
            for value in row:
                # Increase count only when this value matches target.
                pass
    return count
Written answer3 marks

Explain why a list of venue records may be clearer than a 2D array whose columns mean name, capacity and open status.

Compare named fields/types with positional columns.

Students type their answer here.

Closed-book checkpoint

Complete each sentence from memory. There is no answer bank and correctness is held for teacher review.

Fill in the blanks4 marks
A 3D structure needs completion 1 indexes to select one element. Visiting every item normally requires one loop per completion 2. In venue[layer][row][column], the index meanings must be used in a consistent completion 3. A collection may store a completion 4 at each position when each item has named fields.

Review your work

Check that you can trace every row, column and layer in the order used by the algorithm.