Trace tables – OCR GCSE Computer Science lesson (J277)
Pupils learn to complete a trace table for an algorithm with a loop and selection, recording every change to each variable and the output.
Lesson 2 of 11 in unit 10.5 Networks and Searching, taught in Year 10, Summer 1. It answers one big question: How can we check what code does without running it?
By the end, pupils can complete a trace table for an algorithm with a loop and selection, recording every change to each variable and the output.
- The Build (the main task)
- Complete a trace table for the library's late-fine algorithm for a book returned 4 days late, recording every change to day, fine and the output.
- Support version
- Part-filled trace table: the columns are labelled and the first two rows are done, with a note beside the loop saying how many times it runs.
- Challenge
- Trace the algorithm for a book 12 days late, find the logic error that lets the fine go over the £3 cap, and rewrite the line that fixes it.
- Real-world link
- The library's system works out late fines one day at a time – the librarian wants to check it adds up before readers are charged.
- Key words
- Trace table, Dry run and Track, each with a definition, an icon and a common mix-up on the key vocabulary slide.
- Misconceptions it tackles
- “A trace table records only the final value of each variable”; “fine = fine + 25 sets fine to 25”.
- OCR J277 specification
- 2.1.2 (designing, creating and refining algorithms: using trace tables to work out what an algorithm does and to find errors in it).
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 can do it all on paper.
Also sold in the Networks and Searching 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)
- Single-teacher licence: use and adapt it with your own classes
More for GCSE Computer Science (OCR)
See allPupils learn to define a LAN and a WAN, give two differences between them and decide which a given network is.
Free sample lessonPupils learn to explain how bandwidth, latency, the number of users, the transmission media, errors and interference affect network performance.
Pupils learn to describe the roles of computers in client-server and peer-to-peer networks and compare their benefits and drawbacks.
Written for the specifications named. Not endorsed by or affiliated with any exam board.