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
The need for translators
Compilers
Interpreters
Choosing a compiler or interpreter
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.
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).
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.
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.