Object Code 0 / 16
Translator Rank Source Seeker

Unit 2.5 - Translators (Compilers & Interpreters)

paper2.5.2

Question 1 [3 Marks]
Complete the sentences below using the most appropriate terms from the list provided.
[3]

List: [ Assembly, High-level, Machine, Executable, Source, One-by-one ]

A Compiler translates the entire ................................. code in one go.

If there are no errors, it produces an ................................. file.

An Interpreter translates and runs the code ................................. line at a time.
✅ Mark Scheme

1. Source (Accept "High-level")
2. Executable
3. One-by-one (Accept "Line-by-line")

Score:
Question 2 [2 Marks]
A programmer is writing a program in Python to calculate the area of a circle. The code contains a Syntax Error on Line 10. The program is 20 lines long.

(a) If the programmer uses an Interpreter, describe exactly what happens when they try to run the code.
[2]

(b) If the programmer uses a Compiler, describe exactly what happens when they try to translate the code.
[2]
✅ Mark Scheme

No mark scheme available.

Score:
Question 3 [3 Marks]
A software team has finished creating a new video game. They are ready to sell it to customers online.
State which type of translator (Compiler or Interpreter) they should use to prepare the file for customers. Give two reasons for your choice.
[3]

Translator: ............................................................................................

Reason 1: .....................................................................................................
Reason 2: .....................................................................................................
✅ Mark Scheme

Translator: Compiler (1)

Reasons (Any two):
- Creates an executable file (user doesn't need Python) (1).
- Protects the source code (proprietary protection) (1).
- Optimizes the code for faster execution (1).

Score:
Question 4 [2 Marks]
It is often stated that "Compiled code runs faster than Interpreted code."
Explain why this statement is true.
[2]

Note: Do not discuss the speed of translation. Focus on the execution.
✅ Mark Scheme

- The compiler converts code into machine code once before running (1).
- The interpreter must translate every line every time it runs, taking CPU time during execution (1).

Score:
Question 5 [6 Marks]
Many IDEs allow the programmer to "Step through" code line-by-line using a Run-Time Environment. Explain how this feature uses an Interpreter to help the programmer find Logic Errors.
[6]

In your answer, consider:
  • What the interpreter does at each line.
  • What the programmer can see happening in the variables/output.
  • Why this is harder to do with a standard Compiler.
✅ Mark Scheme

Indicative Content:
- The Process: Interpreter runs one line at a time and pauses (1).
- Visibility: Programmer can inspect variable values in the Watch Window during the pause (1).
- Logic Errors: These don't crash code but give wrong results. Watching variables change line-by-line shows exactly where it goes wrong (1).
- Vs Compiler: A compiler produces a "black box" executable; you cannot easily pause to check internal memory states (1).

Score: