2.5.1

Languages

High-level vs low-level languages and how compilers and interpreters differ.

Learning Objectives

  • 1Understand the differences between high-level and low-level programming languages
  • 2Understand the need for translators
  • 3Understand the differences, benefits and drawbacks of using a compiler or an interpreter

High-level and low-level languages

Programming languages come in two levels. High-level languages (like Python) read almost like English, and are designed to be easy for humans to write and understand. Low-level languages (like Assembly language) are much closer to the binary a computer actually understands, and give very precise control over the hardware.
High-level languages (e.g. Python, Java) use instructions similar to structured English, making them easy to read, write and debug, and portable between different types of hardware since they can be translated for whichever processor is running them. Low-level languages (e.g. Assembly language) are much closer to machine code, giving direct control over hardware and registers and executing faster, but are harder to read and write, and tied to one specific type of processor.
The key trade-off is readability and portability (high-level) versus speed and hardware control (low-level). A high-level program can run on many different processor types once translated appropriately for each; a low-level program is written for one specific processor and is not portable. This specification does not require an understanding of assemblers, only of the general characteristics of low-level languages.

The need for translators

A processor can only actually execute machine code (pure binary). Since high-level (and Assembly) languages aren't written in machine code, they need to be converted first, this is the job of a translator.
Computers can only directly execute machine code, binary instructions specific to a processor. Since programs are written in high-level languages for humans to work with, they must be translated into machine code before a processor can run them. This translation is carried out by a compiler or an interpreter.
Translation is essential because there is a fundamental mismatch between how humans want to write code (readable, high-level) and what a processor can actually execute (binary machine code). Without a translator, a high-level program simply cannot be run.

Compilers

A compiler translates the whole program into machine code in one go, before it ever runs, producing a standalone file that can be run any time afterwards without needing the compiler again.
A compiler takes the entire source code, checks it for errors, and translates it all at once into an executable machine code file. If the source code contains an error, none of it is translated. Once compiled, the resulting program can be run repeatedly without needing to be recompiled, and without the original source code or the compiler being present.
A compiled program protects the original source code, since only the executable machine code needs to be distributed, and recovering the original source code from it is very difficult. This is a genuine benefit worth stating explicitly in exam answers, not just "it compiles the whole program".
Two ways to translate source codeCompilerWhole source→Translated once→.exeTranslates the whole program in one goThe result runs later without the compilerReports all the errors together, at the endCompiling takes time before you can run itInterpreterLine 1→Run it→Line 2→Run itTranslates and runs one line at a timeNeeds the interpreter and source every runStops at the first error it reachesEasier to test small changes quickly

Interpreters

An interpreter translates and runs a program one line at a time, rather than all at once. If it reaches a line with an error, it stops there, having already run everything before it.
An interpreter translates and executes source code line by line, rather than producing a separate executable file. It checks for errors as it goes, so a program can partially run until an error is reached, rather than failing to run at all. Both the interpreter itself and the original source code must be present every time the program is run.
Because both the source code and the interpreter must be present at run-time, interpreted programs offer little protection for the source code, unlike compiled programs. This is a genuine drawback worth stating explicitly, alongside the benefit that errors can be pinpointed exactly where translation stopped, which is useful for testing and debugging during development.

Choosing a compiler or interpreter

Compilers and interpreters each have their own benefits. Compiled programs run faster and hide the source code, useful for a finished product. Interpreters are useful while writing and testing code, since they show you exactly where an error occurs.
Choosing between a compiler and an interpreter depends on the situation: a compiler is well suited to distributing a finished, tested program, since it runs faster (already translated) and protects the source code. An interpreter is well suited to development and testing, since it can run and check code incrementally, pinpointing exactly where an error occurs without needing the whole program to be error-free first.
Exam questions specifically ask for reasons or benefits, not just a description of the difference between the two, a response that only explains how a compiler and interpreter differ, without stating a concrete benefit or reason for choosing one, will not score full marks. Strong answers give a specific benefit, e.g. "a compiler lets you distribute an executable without giving access to the source code" or "an interpreter shows exactly where an error occurred without needing the whole program to be correct first".

Exam Phrasing: Use These Exact Phrases

  • ✓High-level languages are easier for humans to read/write and are portable between different hardware
  • ✓Low-level languages give direct control over hardware and execute faster, but are not portable
  • ✓A compiler translates the whole program at once before it runs, an interpreter translates and runs it line by line
  • ✓A compiler protects the source code; an interpreter needs the source code present every time it runs
  • 💡When asked to compare a compiler and an interpreter, give a specific benefit or reason, not just a description of how they differ.
  • 💡Remember a compiled program does not need the compiler or the source code present to run afterwards, an interpreted program needs both present every time.
  • 💡You are not required to understand assemblers for this specification, only the general characteristics of low-level languages.
  • 💡On a benefits question, describing how a compiler translates ("it translates the whole program in one go") earns nothing, examiners are told not to credit it. Give the benefit itself, e.g. it produces an executable that runs without a translator.
  • 💡"Faster" on its own is too vague. Say what it is faster than: a compiled program runs faster than the interpreted version.
  • 💡For the source-code point, frame it around the end user or distribution: "end users have no access to the source code" is credited, a bare "no access to source code" may not be.
  • 💡Low-level language benefits to mention: faster execution, direct hardware/register control. High-level language benefits to mention: easier to read/write/debug, portable between hardware.

Wrong:

A compiler is just "the thing that translates the whole program"

Right:

A compiler translates the whole program at once, and produces an executable that can run afterwards without the source code or compiler present, protecting the source code

Why it matters: Simply describing the mechanical difference does not answer questions that ask for benefits/reasons, examiners specifically require a stated advantage.

Wrong:

An interpreter produces a standalone executable file, like a compiler

Right:

An interpreter translates and runs code line by line, it does not produce a separate executable file

Why it matters: This is a key distinguishing feature, confusing the two removes a major difference the exam tests.

Wrong:

Describing only the difference between high-level and low-level code without giving a reason for choosing one

Right:

Giving a specific reason, e.g. low-level code executes faster and gives direct hardware control

Why it matters: Questions asking for reasons or benefits are not fully answered by a comparison alone.

Question:

A software company is distributing a finished game to customers. Explain one reason why they might choose to use a compiler rather than an interpreter. [2]

💡 Attempt this before revealing the answer, practice makes perfect!

Model Answer:

The company could use a compiler so that the finished game runs as a standalone executable file, without needing the interpreter or original source code present. This also protects their source code from being viewed or copied by customers, and the compiled game will run faster since it has already been translated.

Mark Scheme:

  • 1Identifies a genuine benefit of compiling, e.g. protecting the source code, or not needing the compiler present to run it
  • 2Explains the benefit in the context of distributing a finished product to customers, not just a generic definition

Tap a card to flip it. Use the arrow keys to move and space to flip.

Known 0 Still learning 0
1 / 12

Exam-style questions. Have a go, then reveal the mark scheme to check your answer.

1.State two differences between a high-level language and a low-level language.

[2]

2.Explain why a program written in a high-level language must be translated before it can run.

[2]

3.A programmer is developing and testing a new piece of software. Explain one benefit of using an interpreter at this stage of development.

[2]

4.A company wants to sell a finished application without allowing customers to see or edit the source code. Explain why a compiler would be a suitable choice.

[2]

5.Explain the difference between how a compiler and an interpreter handle a program containing an error partway through.

[3]

6.Compare compilers and interpreters, and explain which a programmer would prefer while writing a program and which they would prefer for distributing the finished program.

[6]

The examiners' reports are the most useful and least read of the three: they say what candidates actually got wrong each year. All files are hosted by OCR.

Past-paper questions grouped by topic

The same OCR questions, sorted by topic rather than by year (via Physics & Maths Tutor).

2025
Paper 2

When naming and describing tools in an IDE, a small number of candidates mistakenly described features of programming languages (such as commenting or variables) rather than tools provided by the IDE itself, these are a common confusion worth avoiding.

2024
Paper 2

Questions on low-level languages and compilers specifically asked for reasons and benefits, not just a description of the differences. Where candidates only discussed the difference between high-level and low-level code, or between translators and compilers, without stating an actual benefit, it was difficult for examiners to award marks. Stronger responses gave specific reasons, e.g. direct control of hardware and faster execution for low-level code, and being able to distribute an executable with no access to source code, without needing to translate again, as benefits of a compiler over an interpreter.