Skip to content

9618 · 5.2

Language Translators — practice questions

Practice and worked examples for 9618 Language Translators. Short previews only — attempt the full question in MarkScheme against the official scheme.

Worked example 1

A software company is developing a high-performance 3D graphics engine for a commercial video game to be sold to the public. Justify, with two distinct reasons, whether a compiler or an interpreter would be more suitable for distributing the final product.

Show solution outline

Translator: Compiler [1 mark]

Justification 1 (Performance): Video games require maximum performance for smooth frame rates and complex calculations. A compiled program is translated into machine code once, allowing it to execute directly on the CPU at high speed. An interpreter would be too slow, as it translates code during runtime, adding significant overhead that would be unacceptable for a graphics engine. [1 mark]

Justification 2 (Intellectual Property): When distributing a commercial product, the company wants to protect its source code. A compiler produces an executable file of machine code, which is extremely difficult to reverse-engineer back into the original source code. Distributing an interpreted script would mean giving away the source code, as the interpreter needs it to run. [1 mark]

Worked example 2

A student is learning to code in Python for their A-Level project. They are constantly writing, testing, and debugging small sections of their program. Explain why an interpreter is beneficial in this scenario.

Show solution outline

Benefit 1 (Immediate Feedback): Python is an interpreted language. When the student runs their code, the interpreter executes it line by line. If there is a syntax or runtime error, the program stops immediately and reports the error and the line number where it occurred. [1 mark] This makes it very easy for a learner to quickly identify and fix mistakes without needing to recompile an entire program. [1 mark]

Benefit 2 (Platform Independence): The student can write their Python code on a Windows PC at school and continue working on it on a Mac at home without any changes. As long as both machines have the Python interpreter installed, the same script will run, which is very convenient during development. [1 mark]