Single lesson · Written for OCR J277

Programming practice: selection – OCR GCSE Computer Science lesson (J277)

Pupils learn to write a complete program using selection, including nested selection, and test every branch with normal and boundary values.

Also in a bundle Memory, Storage and Selection – OCR GCSE Computer Science lessons (J277) 14 lessons for £39 · save 30% on buying separately

Lesson 12 of 14 in unit 10.2 Memory, Storage and Selection, taught in Year 10, Autumn 2. It answers one big question: How do we build and test a program that makes decisions?

By the end, pupils can write a complete program using selection, including nested selection, and test every branch with normal and boundary values.

The Build (the main task)
Write the complete leisure centre ticket program: input age, activity and membership, use selection to work out the price, then test it with a normal and a boundary value for each branch. Start from your kiosk program from the Guided Practice. (The gym desk checks inductions, so the kiosk checks age only.)
Support version
Parsons problem: the program's lines are jumbled, with one distractor line that uses > instead of >=, and a part-filled test table.
Challenge
Find and fix the error in a version that charges a 16-year-old the child price.
Real-world link
The finished kiosk program, tested so the front desk can trust every price it shows.
Key words
Selection, Nested selection and Decision, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“Testing a program with one value is enough if it gives the right answer”; “Using > or >= at a boundary makes no difference”.
OCR J277 specification
2.2.1 (programming fundamentals: selection (IF, ELSE IF, nested IF and CASE), comparison operators and Boolean operators AND, OR, NOT); 2.3.2.

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.

Pupils need computers for the main task.

Also sold in the Memory, Storage and Selection unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.

What's included

  • Slide deck (PowerPoint)
  • Lesson plan (Word)
  • Worksheet (Word)
  • Support worksheet with scaffolds (Word)
  • Python starter program and teacher copy for the kiosk
  • Python starter program and teacher copy for the kiosk
  • Single-teacher licence: use and adapt it with your own classes

More for GCSE Computer Science (OCR)

See all

Written for the specifications named. Not endorsed by or affiliated with any exam board.