A program can be translated by a compiler or by an interpreter.
Explain why a compiled program usually runs faster than an interpreted program.
Mark scheme
Award up to two marks for a linked explanation such as:
- The compiler translates the whole program into machine code before it is run (1) so no translation is needed while the program is executing (1)
- The machine code/object code is already produced before execution (1) so the CPU can carry out the instructions directly without translating them (1)
- The compiled program does not need an interpreter at run time (1) so no time is spent translating each line before it is executed (1)
For both marks, the expansion must follow/associate with the statement.
A statement that translation happens before execution, with no linked reason for faster running, earns 1 mark only.
Do not accept 'faster to run' or 'quicker' on its own without a reason linked to translation before/during execution.
Do not accept 'compiled code is optimised' or 'compilation takes less time' without linking this to translation before execution/at run time.
Do not accept answers about the compiler being installed or available.
The question asks why a compiled program usually runs faster, so answers must refer to when translation happens, not just general performance claims.
Example answers and how they were marked
The compiler translates the whole program into machine code before it is run, so the CPU does not have to translate each line during execution.
Why: Translation before execution (1) linked to no translation needed during the run, so faster (1).
The compiler translates the whole program first.
Why: Pre-translation point (1) but no link to faster running.
A compiled program runs faster because the compiler is installed on the computer.
Why: Compiler being installed does not make execution faster; no credit.