← IGCSE Computer Science Paper 1

Interpreter error reporting

An interpreter runs code line by line and halts at the first error it finds, reporting only that one. Earlier lines have already run. Later errors stay hidden until you fix it and run again.

Understanding Interpreter error reporting in IGCSE Computer Science Paper 1

What it does: A and B are printed first, because those lines ran fine. The interpreter then stops at the broken third line. Only one error is shown at a time. The student must fix it and re-run to see whether another error comes next. An interpreter halts as soon as it meets an error and reports it. It does not carry on to find more. Each run stops at the first error it finds. The programmer fixes it and runs again, so finding 3 errors takes at least 3 runs.

Common mistakes: The closing bracket is missing, so the interpreter stops at line 1 and reports this error. No lines have run, and any mistakes later in the program stay hidden. The line should end with two brackets: input('Name: '). num is text, so adding 1 gives a run-time error. The interpreter has already run line 1, stops at line 2 and never reaches line 3. The fix is int(num) + 1, then run again.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 430–439) and word search (Modules 419–439).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
An interpreter finds an error on line 4 of a program. What does it do?
Stops at line 4 and reports that errorCarries on and reports all errors at the end
Matches
An interpreter lists every error in the whole program at once before running any code.
↓
This describes a compiler, not an interpreter. An interpreter stops at the first error and reports only that one.
Applying
Meanings
Term
stops at first error
Meaning
An interpreter runs code line by line and halts at the first error it finds, reporting only that one. Earlier lines have already run. Later errors stay hidden until you fix it and run again.
Practice
OUTPUT "Step 1 ran"
Testing
Gaps
x = 10 0 # interpreter stops here
Check Answer
Spots
1name = input('Name: '
2print('Hello ' + name)

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Desert Jerboa' badge — High Jumper, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. An interpreter finds an error on line 4 of a program. What does it do?
A. Carries on and reports all errors at the end
B. Stops at line 4 and reports that error ✓
An interpreter halts as soon as it meets an error and reports it. It does not carry on to find more.
2. A program has errors on lines 3 and 8. The student runs it with an interpreter. What is shown?
A. Only the error on line 3 ✓
B. Both errors on lines 3 and 8
Only one error is shown at a time. The line 8 error stays hidden until line 3 is fixed and the program is run again.
3. A program has an error on line 5. Lines 1 to 4 are correct and an interpreter runs it. What happens to lines 1 to 4?
A. They have already run before the error is found ✓
B. They are not run at all
An interpreter translates and runs one line at a time, so lines before the error have already been executed. A compiler would report errors before anything runs.
4. Line 2 of a program is fixed, but the interpreter then reports a new error on line 6. Why was it not reported earlier?
A. The interpreter stopped at line 2 and never reached line 6 ✓
B. The error on line 6 did not exist until line 2 was fixed
The line 6 error was there all along. The interpreter halted at line 2, so it was hidden until the first error was fixed.
5. After fixing the error an interpreter reported, what should the programmer do next?
A. Assume the program has no more errors
B. Run the program again to find any further errors ✓
Fixing one error does not mean the rest of the code is correct. Run again, because the interpreter may now reach a later error.

Match the Pairs

print("Start") print(Hello) print("End") → The interpreter prints Start, then stops at line 2 with an error. The last line never runs.
Line 2 has an error, line 5 has an error → The interpreter reports only the line 2 error. The line 5 error stays hidden until line 2 is fixed.
Lines before the error have already run, so their output appears before the error message → print("A") print("B") print(C
After the interpreter stops at an error, you fix it and run the program again to find the next error → Run -> error on line 3 -> fix line 3 -> run again
An interpreter lists every error in the whole program at once before running any code. → This describes a compiler, not an interpreter. An interpreter stops at the first error and reports only that one.
The interpreter hits an error on line 4, so it skips line 4 and carries on running lines 5 to 10. → An interpreter does not carry on after an error. It halts at line 4, so lines 5 to 10 do not run.

Key Term

stops at first error
An interpreter runs code line by line and halts at the first error it finds, reporting only that one. Earlier lines have already run. Later errors stay hidden until you fix it and run again.

Fill in the Blanks

1. print("Start") x = 10 / 0 # interpreter stops here print("End") # never runs
Hint: Type the operator that divides one number by another. It causes the run-time error where the interpreter stops.
2. name = "Sam" print(name) # runs before the error print(age) # error: age not defined
Hint: Type the function that displays output. This line has already run before the interpreter reports the error.
3. x = 10 / 0 # error 1: shown first y = int("abc") # hidden until error 1 fixed
Hint: Type the built-in function that converts text into a whole number. Its error stays hidden until the first error is fixed.
4. errors = 3 while errors > 0: errors = errors - 1 # fix, run again
Hint: Type the comparison operator meaning 'greater than', so the loop repeats while errors remain to fix.
5. for n in range(1, 6): if n == 3: # error found on line 3 break # stop, later lines never run
Hint: Type the keyword that exits a loop immediately, like an interpreter halting at the first error.

Spot the Error

Question 1
A name = input('Name: '
B print('Hello ' + name)
C print('Welcome')
Line A — The closing bracket is missing, so the interpreter stops at line 1 and reports this error. No lines have run, and any mistakes later in the program stay hidden. The line should end with two brackets: input('Name: ').
Question 2
A num = '7'
B print(num + 1)
C print('Finished')
Line B — num is text, so adding 1 gives a run-time error. The interpreter has already run line 1, stops at line 2 and never reaches line 3. The fix is int(num) + 1, then run again.
Question 3
A print('Start')
B score = 10
C print('Score: ' + score)
D print('End')
Line C — A string cannot be joined to a number, so the interpreter stops here at line 3. 'Start' and the score assignment have already run. Use str(score) to fix it, then run again.
Question 4
A items = ['pen', 'ruler']
B print(items[0])
C print(items[2])
Line C — The list only has positions 0 and 1, so items[2] is out of range. Lines 1 and 2 have already run, so 'pen' was printed. The interpreter stops at line 3 and shows only this error. The fix is items[1].
Question 5
A improt random
B num = random.randint(1, 6)
C print(num)
Line A — The keyword import is misspelt, so the interpreter stops at line 1 and reports one error. Nothing has run before it. Correct it to import random and run again to find any later errors.

Student with a class code? Join your class →