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

Debugging

301.13 Testing

Practise exam questions

Testing — Note 6 of 6

Find and fix logic errors.

What you need to know

Debugging is the process of finding and fixing errors. Syntax errors are caught by Python, but logic errors produce wrong results and must be found by testing and tracing.

What to know

  • Syntax error: code won't run (e.g. missing colon)
  • Logic error: code runs but gives wrong answer
  • Use print() statements to check variable values
  • Use a trace table to find where logic goes wrong
  • Fix the bug, then re-test to confirm

Code examples

Debugging with print
python
def average(a, b):
    total = a + b
    print("DEBUG: total=" + str(total))  # temporary
    avg = total / 2
    return avg

print(average(10, 20))  # DEBUG: total=30 → 15.0
← Previous noteTest tables301.13 TestingNext topic →Random integers301.14 Random Number Generation

Back to Testing

Specification notes for programming are in Paper 2.

Testing

Note 6 of 6

  1. 1Why test?
  2. 2Test data types
  3. 3Dry run tracing
  4. 4Expected vs actual
  5. 5Test tables
  6. 6Debugging
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).