Explain how an interpreter runs a program
Trace line-by-line translation and execution and describe what happens when an error is reached.
This sequence follows Cambridge IGCSE Computer Science 0478, 2026–2028 syllabus Version 6. It covers subject content sections 4.1–4.2 only. The separately published 2029–2031 syllabus is not mapped here. Practice is original, self-checked and does not award an official Cambridge grade. Full timed papers and human subject-teacher review remain outstanding.
Before you begin
- No programming language is required. Be comfortable with place value and multiplication; each lesson introduces the computer-science notation it uses.
Work on paper. Try each question before revealing help, and explain why your method works.
Quick readiness check
Which translator stops when it reaches an error during execution?
What you will learn
- Describe line-by-line interpretation
- Explain how execution responds to an error
- Relate interpretation to interactive development
An interpreter translates and executes line by line
An interpreter reads a high-level program, translates a line and executes it before moving on. If it finds an error, execution stops at that point and the programmer can inspect and correct the source.
Apply and check the rule
This approach is useful during development because a change can be run without building a complete executable first. The interpreter is generally needed when the program is run, and interpretation can take longer than running a compiled executable.
Pause and explain
What can the programmer do after an interpreter reports an error?
Worked example
An interpreter reaches an invalid statement on line 12. What happens?
Show the worked solution
- Earlier lines have been translated and executed.
- The interpreter reports the error and stops at line 12.
- The programmer can correct the source and run it again.
Answer Execution stops when the interpreter finds the error; the programmer fixes it and runs the program again.
Try a topic test
Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.
Test this topic →From guided practice to a new situation
Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.
State the interpreter's action when it reaches a valid line of high-level code.
Give me a hint
Include both translation and execution.
Compare my reasoning
- It translates the line.
- It executes that line before moving to the next.
It translates and executes the line, then continues to the next line.
Look for these in your work
- Translation stated
- Execution order stated
Why might a programmer use an interpreter while developing a program?
Give me a hint
Consider feedback after a small change.
Compare my reasoning
- The program can be run line by line during development.
- An error stops execution near where it is encountered.
- The programmer can correct the source and test it again quickly.
It supports rapid development checks and stops at an encountered error so the source can be corrected and retested.
Look for these in your work
- Development use
- Error feedback
- Iteration
A student says an interpreter always creates a final executable that runs without the interpreter. Correct the claim.
Give me a hint
Distinguish interpretation from whole-program compilation.
Compare my reasoning
- An interpreter translates and executes source line by line.
- The interpreter is generally needed to run the program.
- A compiler instead produces an executable after translating the whole program.
An interpreter normally translates and executes the source as it runs; a standalone executable is associated with compilation, not ordinary interpretation.
Look for these in your work
- Line-by-line process
- Runtime translator
- Compiler distinguished
Common mistakes
- Saying an interpreter reports every future error before any code runs
- Assuming interpretation produces a standalone executable
What can you explain now?
What does an interpreter do with source code?
Compare with the explanation
Translates and executes it line by line
The interpreter processes each line as the program runs.
After trying it yourself, choose your next review. This is your self-assessment.
Your review choice appears on Today. Sign in to sync it across devices.
Make it stick
How does an interpreter's response to an error differ from a compiler's whole-program report?
If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.