Community resourceWorksheet

J277 2.5.1 Compilers and interpreters

Part 2 of 4 · J277 2.5 · Programming languages and IDEs

The two translators OCR requires, and the benefits and drawbacks that follow from how each one works.

Students will:

  • explain why source code must be translated
  • describe how a compiler translates a program
  • describe how an interpreter translates a program
  • give the benefits and drawbacks of each
  • choose the translator that suits a stated situation

Inside: 4 explanation cells, 2 multiple-choice questions, 1 fill-in-the-blanks cell and 4 written answers. 20 marks, about 45 minutes.

Series: J277 2.5 · Programming languages and IDEs, part 2 of 4.

Shared by Coding PathwayVerified teacher

  • 11 cells
  • About 45 minutes
  • CC BY-SA 4.0
  • Shared 17 Aug 2026
  • Updated 9 Sept 2026

Preview

The whole resource, exactly as a class sees it. Answers and marking are held back.

Translators: compilers and interpreters

Source code written in a high-level language cannot be executed directly by the CPU. A translator converts it into a form the processor can execute.

OCR requires two types of translator:

  • a compiler, which translates the whole source program and can produce a separate executable file;
  • an interpreter, which translates and executes source code one statement at a time.

An assembler is not required for J277. Do not use “compiler” as another word for every translator: a compiler and an interpreter behave differently.

Two translation routes

Comparison of compilation and interpretation A compiler translates the whole source program, reports errors and produces an executable file which can be run again. An interpreter translates and executes one statement at a time, stops when it reaches an error, and must interpret the source again on another run. High-level source code needs a translator Source programcomplete code Compilertranslates the whole program Executable filecan run again without the compileron a compatible system Source programneeded for each run Interpreterone statement at a time Translate and executestops at an errorinterprets again on another run Compilation route Interpretation route
Fill in the blanks4 marks
Complete the comparison. A label 1 translates the whole program and can produce an label 2 file. An label 3 translates and executes one statement at a time and normally stops when it reaches an label 4.
  • compiler
  • executable
  • interpreter
  • error
  • editor
  • processor
Multiple choice1 mark

A developer changes one statement and wants to run it immediately, stopping at the first error encountered. Which translator is most suitable during this work?

  • ACompiler
  • BEditor
  • CLogic gate
  • DInterpreter
Multiple choice1 mark

Which is a genuine benefit of compilation when distributing a completed program?

  • AUsers can run the executable without receiving the source code or compiler
  • BThe source is translated one line at a time on every run
  • CThe program can run on every processor without a compatible executable
  • DCompilation guarantees that the program contains no logic errors

Benefits and drawbacks

CompilerInterpreter
Can produce an executable fileUsually requires the source code and interpreter whenever the program runs
The executable can run repeatedly without translating the source againChanges can be run without compiling the whole program first
Completed code can execute faster than interpreting it each timeStops at an error, which can make the location easier to investigate
Several errors may be reported after compilationUsually reveals one reached error at a time
A compatible executable is needed for the target processor and operating environmentA suitable interpreter is needed on the target system

Neither translator automatically fixes errors. Successful translation also does not prove that the program's logic is correct.

Written answer2 marks

Explain why a high-level program needs a translator before the CPU can execute it.

Link the form of the source code to the form understood by the processor.

Students type their answer here.

Written answer4 marks

Compare how a compiler and an interpreter translate and run a program.

Make two direct comparisons: amount translated and what happens when the program is run again.

Students type their answer here.

Written answer6 marks

A small game is complete and will be sold to users who should not receive its source code. Explain three benefits of using a compiler rather than an interpreter.

Develop each benefit into a consequence for the developer or users. Do not repeat the definition of a compiler three times.

Students type their answer here.

Written answer2 marks

Correct the claim: ‘If a program compiles successfully, it has no errors.’

Distinguish translation or syntax success from program logic.

Students type their answer here.

Review

Retrieve one sentence for the purpose of any translator, then compare compiler and interpreter using four headings: amount translated, error handling, later runs and distribution.