Thinking ahead: inputs, outputs and preconditions – OCR A Level Computer Science lesson (H446)
Students learn to identify the inputs, outputs and preconditions of a problem and explain why reusable program components are needed.
Lesson 7 of 16 in unit 12.2 Programming Foundations and Computational Thinking, taught in Year 12, Autumn 1. It answers one big question: What must a programmer decide before writing any code?
By the end, students can identify the inputs, outputs and preconditions of a problem and explain why reusable program components are needed.
- The Build (the main task)
- Identify the inputs, outputs and preconditions of a Fernbridge CycleShare subroutine that calculates the refund due when a rider reports a faulty bike, and explain two benefits of making it a reusable component (6 marks).
- Support version
- A three-column planning frame (inputs · outputs · preconditions) with one row filled in and the prompt 'What must already be true?' beside the preconditions.
- Challenge
- Explain why stating a precondition can make a subroutine shorter but also riskier.
- Real-world link
- Fernbridge CycleShare refunds riders whose bike develops a fault during a hire.
- Key words
- Precondition, Reusable component and Anticipate, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “Inputs are devices such as a keyboard or a touchscreen”; “A precondition is something the subroutine checks for itself”.
- OCR H446 specification
- 2.1.2 (a); (b); (d).
Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.
Students can do it all on paper.
Also sold in the Programming Foundations and Computational Thinking unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.
An independent resource written for OCR A Level Computer Science (H446). It is not endorsed by OCR or Cambridge University Press & Assessment. Programming project (NEA) lessons teach general skills on a made-up example project and give supervised time, within JCQ's rules on the help a centre may give.
What's included
- Slide deck (PowerPoint)
- Lesson plan (Word)
- Worksheet (Word)
- Support worksheet with scaffolds (Word)
- Single-teacher licence: use and adapt it with your own classes
More for A Level Computer Science
See allStudents learn to name the debugging tools in their IDE and write a short algorithm in both Python and OCR exam pseudocode.
Free sample lessonStudents learn to identify sequence, selection and iteration in code, and choose between IF, ELSEIF and SWITCH for a task.
Students learn to choose the correct primitive data type for each item of data and use casting to convert between types.
Written for the specifications named. Not endorsed by or affiliated with any exam board.