Community resourceWorksheet

1CP2-CT-10.1 Records rows fields and two-dimensional structures

Part 1 of 5 · 1CP2-CT-10 · Integrated programming and data structures

A two-dimensional structure stores rows containing related fields. In Python's PLS representation, it is a list of lists. The first index selects a row; the second selects a field inside that row.

Students will:

  • represent related fields as typed rows
  • use the first index for a row and the second for a field
  • preserve the meaning and type of each field
  • trace reads from a two-dimensional structure

Inside: 5 explanation cells, 1 fill-in-the-blanks cell, 3 multiple-choice questions, 3 written answers and 1 trace table. 12 marks, about 45 minutes.

Series: 1CP2-CT-10 · Integrated programming and data structures, part 1 of 5.

Shared by Coding PathwayVerified teacher

  • 13 cells
  • About 45 minutes
  • CC BY-SA 4.0
  • Shared 17 Aug 2026

Preview

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

Records, rows, fields and two-dimensional structures

A two-dimensional structure stores rows containing related fields. In Python's PLS representation, it is a list of lists. The first index selects a row; the second selects a field inside that row.

1. Read row then field

Rows and fields in a two-dimensional structurefield 0field 1field 2field 3row 0row 1row 2AshaRed68YBenBlue73NCaraRed81Yrecords[1][2] → 73

In records[1][2], index 1 selects Ben's row and index 2 selects the score field. Each row should follow the same field order. A whole row represents one record; a column position represents one kind of field.

Fill in the blanks3 marks
The first index chooses a gap 1. The second chooses a gap 2 inside it. For three rows, the final row index is gap 3.
  • 2
  • field
  • row
Multiple choice1 mark

Given records = [["A", 4], ["B", 7]], what is records[1][0]?

  • AA
  • B4
  • CB
  • D7

2. Preserve field meaning and type

A record may contain mixed types: a name string, an integer score and a Boolean membership flag. CSV input begins as text, but after parsing, numeric fields should be converted so comparisons and arithmetic behave correctly.

Written answer2 marks

For clubs = [["Mina", "Chess", 6], ["Owen", "Code", 8]], state the expressions that access Code and 6.

Give one two-index expression for each value.

Students type their answer here.

3. Predict before execution

records = [["Asha", 12], ["Ben", 18], ["Cara", 14]]
total = 0
for row in records:
    total = total + row[1]
print(total)
Multiple choice1 mark

What exact value is printed?

  • A3
  • B14
  • C44
  • D121814
Written answer2 marks

Explain why row[1] changes on each loop pass even though the expression is unchanged.

Refer to the current row variable.

Students type their answer here.

Trace table5 marks

Complete the row-traversal trace.

Record row, score and total each iteration.

Use one row for each pass through the loop. Fill in a box only when that value changes on that row, and leave the rest blank.

ProgramPython
  1. records = [["A", 3], ["B", 5], ["C", 2]]
  2. total = 0
  3. for row in records:
  4. score = row[1]
  5. total = total + score
  6. print(total)
Trace table with 5 columns
RowrecordstotalrowscoreOutput
1
2
3
4
5
6
7
Written answer2 marks

Explain why a two-dimensional structure is more suitable than three unrelated lists for records that must be processed row by row.

Link grouped fields to consistency or traversal.

Students type their answer here.

Multiple choice1 mark

Which statement is accurate?

  • AEvery 2D structure is a database
  • BThe first index always means a column
  • CA row can hold related fields in a fixed order
  • DAll fields must be strings

Route forward

You can access rows and fields reliably. Next you will use nested traversal, formatted display and linear search over a named field.