New
New
Year 10
AQA

Using trace tables

I can use trace tables to trace how variables change in a while loop.

New
New
Year 10
AQA

Using trace tables

I can use trace tables to trace how variables change in a while loop.

These resources will be removed by end of Summer Term 2025.

Switch to our new teaching resources now - designed by teachers and leading subject experts, and tested in classrooms.

These resources were created for remote use during the pandemic and are not designed for classroom teaching.

Lesson details

Key learning points

  1. Trace tables are used to record how the values of variables change during the execution of a program.
  2. Trace tables and while loops help debug programs.

Keywords

  • Trace table - a tool used to track the values of variables and the flow of execution in an algorithm or program, step by step

  • Condition - used to control the flow of execution in a program; a condition contains a logical expression

Common misconception

The condition in a while loop is only checked once. The loop will always run a fixed number of times.

Remind students that the condition is checked before each iteration. The loop repeats only while the condition is True. Variable changes inside the loop affect whether it continues or stops.


To help you plan your year 10 computer science lesson on: Using trace tables, download all teaching resources for free and adapt to suit your pupils' needs...

Model how the condition is re-evaluated with each loop cycle. Walk through a trace table together, updating the variable and condition step by step.
Teacher tip

Equipment

Licence

This content is © Oak National Academy Limited (2025), licensed on Open Government Licence version 3.0 except where otherwise stated. See Oak's terms & conditions (Collection 2).

Lesson video

Loading...

6 Questions

Q1.
What is iteration in programming?
Correct answer: the process of repeating a sequence of instructions within a program loop
writing a program without loops
running a program once
debugging a program
Q2.
What does a condition in programming evaluate to?
a string
a number
Correct answer: True or False
a list
Q3.
What is the keyword for condition-controlled iteration in Python?
Correct Answer: while, while()
Q4.
When does a
while
loop stop executing?
when the program ends
Correct answer: when the condition becomes False
after 10 iterations
when all variables are used
Q5.
What happens if the condition in a
while
loop is always True?
the program crashes
the loop never runs
Correct answer: an infinite loop occurs
the loop runs once
Q6.
Arrange the steps of a
while
loop.
1 - Evaluate the condition.
2 - Execute the loop body.
3 - Update variables.
4 - Repeat if condition is True.

6 Questions

Q1.
Match the term to its definition.
Correct Answer:trace table,tracks variable values step by step

tracks variable values step by step

Correct Answer:condition,logical expression controlling program flow

logical expression controlling program flow

Correct Answer:while loop,repeats code while a condition is True

repeats code while a condition is True

Correct Answer:debugging,fixing errors in a program

fixing errors in a program

Q2.
What is the purpose of a trace table?
to write new code for a program
to display the program's output
Correct answer: to track the values of variables during program execution
to compile a program
Q3.
What happens if the condition in a
while
loop is False?
Correct answer: the loop does not run
the loop runs once
the loop runs indefinitely
the loop skips to the next condition
Q4.
When is the condition in a
while
loop checked?
only at the start of the program
only at the end of the program
Correct answer: before each iteration
after each iteration
Q5.
What does a trace table record?
the errors in a program
the steps to write a program
standard messages like "Welcome"
Correct answer: the changes in variable values
Q6.
Arrange these steps in the correct order for using a trace table.
1 - Write the program.
2 - Create a trace table.
3 - Record variable changes.
4 - Debug the program.