Revise Computing
Revision notesQuestionsFor schools
Log inStart revising free
Revision notesQuestionsFor schoolsLog in
GCSE Computer Science/Supplementary programming practice/Variables and Constants

Tracing variables

301.3 Variables and Constants

Practise exam questions

Variables and Constants — Note 3 of 4

Track value changes in code.

What you need to know

Tracing means following code line by line and recording the value of each variable after each statement. This is often done with a trace table.

What to know

  • Write each variable as a column
  • Step through each line and update values
  • A trace table shows the value after each line executes
  • Helps find logic errors by hand

Code examples

Trace this code
python
x = 3
y = x + 2
x = y * 2
# Trace: x=3 → y=5 → x=10
← Previous noteConstants301.3 Variables and ConstantsNext note →Naming conventions301.3 Variables and Constants

Back to Variables and Constants

Specification notes for programming are in Paper 2.

Variables and Constants

Note 3 of 4

  1. 1Declare variables
  2. 2Constants
  3. 3Tracing variables
  4. 4Naming conventions
Topic overview

© 2026 Revise Computing · revisecomputing.co.uk

Privacy noticeTermsContact

Revise Computing is an independent revision resource. It is not affiliated with, or endorsed by, OCR (Oxford Cambridge and RSA Examinations).