Community resourceWorksheet
1CP2-CT-4.7 Formatting structures validation and search checkpoint
Part 7 of 7 · 1CP2-CT-4 · Structures, validation and search
The checkpoint for the whole series, integrating formatting, structures, validation and search.
Students will:
- choose the format descriptor a stated presentation requires
- explain both indexes of a two-dimensional read
- describe a validation routine including its control structure
- state the comparisons a complete search of an absent target makes
- write an integrated program and correct a fixed-row search error
Inside: 4 explanation cells, 3 multiple-choice questions, 1 Python task, 1 fill-in-the-blanks cell and 3 written answers. 20 marks, about 45 minutes.
Series: 1CP2-CT-4 · Structures, validation and search, part 7 of 7.
Shared by Coding PathwayVerified teacher
- 12 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.
1CP2-CT-4 checkpoint
This checkpoint assesses formatting, rectangular two-dimensional structures, traversal, validation and linear search. It introduces no new syntax or principles content.
- format
- linear
- record
- row
- while
Which descriptor displays 6.2 as 6.20 right aligned in width 8?
- A`{:<8s}`
- B`{:>8.2f}`
- C`{:^2d}`
- D`{:8.20}`
For rows = [["A", 4], ["B", 7], ["C", 2]], give the expression that reads 7 and explain both indexes.
State row then field.
Students type their answer here.
Validation application
A club code must contain exactly two letters followed by three digits and must not be empty. A complete answer identifies suitable checks and explains how repeated prompting works.
Describe how a program could validate the club code, including the checks and control structure required.
Use presence, length, simple pattern functions and repetition.
Students type their answer here.
A target is absent from a list of six items. How many comparisons does a complete linear search make?
- A0
- B1
- C5
- D6
Integrated programming task
Write a function find_product(records, target_code) that linearly searches field 0 of rectangular records. Return the matching row or an empty list. Call it for P12, store the result in match, and print "{:<8} {:>4d}".format(match[1], match[2]).
The data is supplied in the starter.
products = [["P10", "Pen", 12], ["P11", "Pad", 7], ["P12", "File", 9]]
# Define find_product, call it for P12, format and print the result.
A record search uses records[0][index] while moving index from 0 upward. Explain the error and correct the expression for searching field 0 across rows.
Identify which index should vary.
Students type their answer here.
Which statement shows appropriate decomposition of a record search?
- APut every responsibility in one unexplained expression.
- BSeparate target input, row traversal, key comparison and outcome handling.
- CCompare every field even when only ID identifies a record.
- DRemove the not-found outcome.
Route forward
This checkpoint closes 1CP2-CT-4. File input/output and programmed authentication are deliberately reserved for the next CT series.