← IGCSE Computer Science Paper 1

Comparing a compiler and an interpreter

A compiler translates the whole program into an executable before it runs; an interpreter translates and runs line by line, stopping at the first error, with no executable.

Understanding Comparing a compiler and an interpreter in IGCSE Computer Science Paper 1

What it does: Because a compiler reads the whole program, it can report every error it finds in one go, so the programmer can fix many errors before running. An interpreter runs one line at a time, so it halts when it reaches an error and never reports the errors further down. A compiler creates an executable file. An interpreter produces no executable, so the source code and the interpreter are needed each time. The speed claim is the wrong way round. The compiler does the translation once, whereas the interpreter repeats it on every run, which makes interpreted programs slower.

Common mistakes: A compiler translates the whole program, so it reports all the errors it finds together. Stopping at the first error is what an interpreter does. It should say 'errors: full list reported'. An interpreter translates and runs the code each time and does not produce an executable file. It should say 'executable: none'.

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 440–449) and word search (Modules 440–463).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which translator converts the whole program into machine code before it runs?
An interpreterA compiler
Matches
An interpreter creates an executable file that can be sent to other users
↓
An interpreter does not create an executable file. Only a compiler does. Users need the interpreter and the source code to run the program.
Applying
Meanings
Term
compiler vs interpreter
Meaning
A compiler translates the whole program into an executable before it runs; an interpreter translates and runs line by line, stopping at the first error, with no executable.
Practice
COMPILER: translates the whole program at once
Testing
Gaps
Compiler: translates the program
Check Answer
Spots
3 executable: yes
4 errors: stops at first one

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

The 'Cosmic Dragon' badge — Orbit Master, 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. Which translator converts the whole program into machine code before it runs?
A. A compiler ✓
B. An interpreter
A compiler translates the whole source code in one go. An interpreter translates and runs one line at a time.
2. Which translator works through the code line by line, translating and running each line in turn?
A. A compiler
B. An interpreter ✓
An interpreter translates one line, runs it, then moves to the next line. A compiler does not work like this.
3. Which translator produces an executable file that can be run without the source code?
A. A compiler ✓
B. An interpreter
A compiler creates an executable file. An interpreter produces no executable, so the source code and the interpreter are needed each time.
4. A student wants to give a finished program to a friend who does not have the source code or any translator. Which statement is correct?
A. Compile it and share the executable file ✓
B. Share it and let the friend use an interpreter on the source code
The executable made by a compiler runs on its own. An interpreted program needs the source code and an interpreter every time it runs.
5. A program has three syntax errors. Which translator reports all of them together after attempting to translate the whole program?
A. An interpreter
B. A compiler ✓
A compiler gives a full error report for the whole program. An interpreter stops at the first error it finds.

Match the Pairs

compiler: translates the whole program → The compiler translates all of the source code in one go and produces an executable file, which can then be run without the compiler or the source code.
interpreter: translates line by line → The interpreter translates one statement, runs it, then moves to the next. It produces no executable file, so the source code and interpreter are needed every time.
A compiler gives a full list of errors after it has tried to translate the whole program → Compiler: Error on line 3, Error on line 9, Error on line 14
An interpreter stops at the first error it meets, so later lines are not checked until that one is fixed → Interpreter: Error on line 3 - stopped
An interpreter creates an executable file that can be sent to other users → An interpreter does not create an executable file. Only a compiler does. Users need the interpreter and the source code to run the program.
A compiled program must be translated again every time it is run, so it runs more slowly than an interpreted one → A compiled program is translated once into an executable, so it runs without further translation and is usually faster. An interpreted program is translated every time it runs.

Key Term

compiler vs interpreter
A compiler translates the whole program into an executable before it runs; an interpreter translates and runs line by line, stopping at the first error, with no executable.

Fill in the Blanks

1. Compiler: translates the whole program
Hint: Type the word describing how much of the program a compiler translates in one go.
2. Interpreter: translates line by line
Hint: Type the unit of code an interpreter translates and runs one at a time.
3. Compiler produces an executable file
Hint: Type the kind of file a compiler creates that can run without the source code.
4. Interpreter stops at the first error
Hint: Type the word that says which error makes an interpreter stop.
5. Compiled code runs faster than interpreted
Hint: Type the comparison word for how quickly compiled code runs compared with interpreted code.

Spot the Error

Question 1
A compiler:
B translates: whole program
C executable: yes
D errors: stops at first one
Line D — A compiler translates the whole program, so it reports all the errors it finds together. Stopping at the first error is what an interpreter does. It should say 'errors: full list reported'.
Question 2
A interpreter:
B translates: line by line
C executable: yes
D errors: stops at first one
Line C — An interpreter translates and runs the code each time and does not produce an executable file. It should say 'executable: none'.
Question 3
A IF translator = compiler THEN
B translate whole program
C ELSE
D translate the whole program
E ENDIF
Line D — The ELSE branch covers the interpreter, which translates one line at a time. Translating the whole program is the compiler's job in the first branch.
Question 4
A Speed: compiled code is slower
B Reason: already translated
C Interpreted code: translated
D again every time it runs
Line A — Compiled code is already translated into an executable, so it usually runs faster. An interpreter has to translate the code again each run, which makes it slower. Line 1 should say 'faster'.
Question 5
A Compiler error report:
B stops after the first error
C fix them, then recompile
Line B — A compiler gives a full error report after it has tried to translate the whole program. Stopping at the first error describes an interpreter.

Student with a class code? Join your class →