Community resourceWorksheet

1CP2-CT-7.5 Programming subprograms and libraries checkpoint

Part 5 of 5 · 1CP2-CT-7 · Subprograms, scope and libraries

The checkpoint for the whole programming topic 7 series, sampling constructs, subprograms, scope, maths methods and output formatting.

Students will:

  • predict the output of a program that calls its own functions
  • trace a function call and record the values that change
  • define a local variable and justify limiting global ones
  • select the permitted method for a stated calculation
  • construct a program that separates calculation from presentation

Inside: 4 explanation cells, 3 multiple-choice questions, 1 Python task, 1 trace table and 4 written answers. 17 marks, about 45 minutes.

Series: 1CP2-CT-7 · Subprograms, scope and libraries, part 5 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.

1CP2-CT-7 checkpoint

This checkpoint assesses programming constructs, one-dimensional traversal, parameterised subprograms, scope, maths/time methods, rounding and formatting. It introduces no new methods. Read supplied code without executing prediction questions.

1. Read and predict

Read this code without running it.

import math

def boxes(items, capacity):
    return math.ceil(items / capacity)

values = [7, 12, 13]
total = 0
for value in values:
    total = total + value
print(boxes(total, 10))
Multiple choice1 mark

What exact value is printed?

  • A3
  • B3.2
  • C4
  • D32
Written answer3 marks

Explain how the code produces its output.

Include iteration, the function arguments and `math.ceil`.

Students type their answer here.

Trace table6 marks

Complete the trace table for the function call.

Record each item, changes to count, and the returned result.

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. def count_passes(scores):
  2. count = 0
  3. for score in scores:
  4. if score >= 10:
  5. count = count + 1
  6. return count
  7. answer = count_passes([10, 7, 14])
  8. print(answer)
Trace table with 7 columns
Rowscores (count_passes)count (count_passes)score (count_passes)answerReturn valuescore >= 10Output
1
2
3
4
5
6
7
8
Written answer2 marks

Define a local variable and explain one reason to minimise global variables.

Give both the definition and a linked program-quality reason.

Students type their answer here.

Multiple choice1 mark

Which expression gives the square root of distance using the Pearson subset?

  • A`sqrt.distance()`
  • B`math.sqrt(distance)` after `import math`
  • C`distance **`
  • D`round.sqrt(distance)`
Written answer2 marks

Explain the difference between round(value, 2) and "{:.2f}".format(value).

Separate stored numeric value from displayed representation.

Students type their answer here.

2. Construct

Define root_mean(values) to total the supplied non-empty list, calculate its mean and return math.sqrt(mean). Call it for [4, 12, 20], store the result in answer, and print exactly Result: 3.46. Use a local accumulator, round(answer, 2) and string.format.

Coding task5 marks
import math

# Define root_mean(values), call it, round and format the answer.
Multiple choice1 mark

Which statement accurately describes time.sleep(1.5)?

  • AIt measures how long the program has run.
  • BIt suspends the current process for 1.5 seconds.
  • CIt sets the clock to 1:30.
  • DIt runs the next line 1.5 times.
Written answer2 marks

Explain one benefit of separating calculation into a function that returns a value and presentation into a procedure or main-program section.

Connect separation to reuse, testing or change.

Students type their answer here.

Check before submitting

Check inclusive boundaries, distinguish return from print, keep intermediate names local, and use only the permitted library and formatting syntax. Your trace and constructed program should agree with your written reasoning.