Exam-style question
Try this first
Explain the need for translators and compare a compiler, an assembler and an interpreter.
Model answer
What a good answer should say
- Translators are needed because source code written by programmers is not necessarily in the machine code that a processor can execute.
- A compiler translates a high-level language program into machine code, usually producing a translated program that can then be executed.
- An assembler translates assembly language into machine code.
- An interpreter translates and executes a high-level language program during execution, typically one statement at a time.
Explanation
Why this works
A strong answer identifies the general need for translation and gives the correct role of each translator. It should distinguish a compiler from an interpreter by describing whether translation produces a complete translated program before execution or occurs during execution.
It should also identify assembly language as the input to an assembler.
Common mistake
No common mistake is linked to this question yet.
