Single lesson · Written for AQA GCSE Computer Science (8525)

Nested iteration – AQA GCSE Computer Science lesson (8525)

Pupils learn to trace and write nested iteration, explaining how many times the inner loop runs.

Also in a bundle Binary, Logic and Iteration – AQA GCSE Computer Science lessons (8525) 13 lessons for £39 · save 25% on buying separately

Lesson 8 of 13 in unit 10.3 Binary, Logic and Iteration, taught in Year 10, Spring 1. It answers one big question: What happens when one loop runs inside another?

By the end, pupils can trace and write nested iteration, explaining how many times the inner loop runs.

The Build (the main task)
Complete the trace table for the algorithm. (4 marks) Write a program that outputs each room number from 1 to 3 with each of its 4 light numbers, for example Room 1 light 1. (4 marks)
Support version
A part-filled trace table with the outer loop column completed.
Challenge
State how many times the inner loop's body runs in total in your Build program, and explain how you know. (3 marks) Write a program that inputs the number of rooms and the number of lights in each room, outputs every room and light number, then outputs the total number of lights once, at the end. (5 marks) Complete the trace table for this algorithm. (5 marks)
Real-world link
The hub switches off every light in every room.
Key words
Nested iteration, Step and Track, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“The inner loop runs only once in total”; “The inner counter keeps counting up across outer passes”.
AQA 8525 specification
3.2.2 (programming concepts: definite, indefinite and nested iteration).

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 Binary, Logic and Iteration unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.

Choose your school's Paper 1 language when you buy: C#, Python or VB.NET. You get that language's files: every program, code example, worked answer and programming task is written in it, and lessons with no code are the same in all three. Algorithms are also shown in AQA pseudo-code, as in the exam.

An independent resource written for AQA GCSE Computer Science (8525). It is not endorsed by AQA.

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
  • Your choice of Paper 1 language: C#, Python or VB.NET

More for GCSE Computer Science (AQA)

See all

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