Medium4 marksStructured
AQA GCSE · Question 07.2 · Computer systems
Explain how an interpreter works.
Explain how an interpreter works.
How to approach this question
Break down the process of interpretation.
1. What kind of code does it start with? (Source code)
2. How does it process the code? (Line by line, one statement at a time)
3. What does it do after translating a line? (Executes it immediately)
4. Does it produce a final, separate file? (No)
5. What happens when it finds an error? (Stops execution)
Combine these points into a coherent explanation.
Full Answer
An interpreter is a program translator that works on high-level languages. It translates and executes the source code one statement at a time, line-by-line. It does not create a separate executable file. If an error is found on a line, the program stops running immediately at that point, which aids in debugging. Because it translates each line every time the program is run, execution is generally slower than with a compiled program.
An interpreter is a type of translator used for high-level programming languages. Its method of operation is distinct from a compiler. Here is a step-by-step explanation:
1. **Line-by-Line Translation:** The interpreter reads the source code one line or statement at a time.
2. **Immediate Execution:** As soon as it translates a single line into machine code, it immediately executes that code.
3. **Sequential Process:** It then moves to the next line, translates it, and executes it, continuing this process until the end of the program or until an error is encountered.
4. **No Executable File:** Unlike a compiler, an interpreter does not produce a standalone executable file of the entire program. The source code and the interpreter are needed every time the program is run.
5. **Error Handling:** If the interpreter finds an error on a line, it stops execution at that point and reports the error, which can make debugging easier as the exact location of the error is known.
Common mistakes
✗ Confusing an interpreter with a compiler (e.g., saying it creates an executable file or translates the whole program at once).
✗ Vague statements like "it interprets the code".
✗ Not providing enough distinct points to gain all the marks.
Practice the full AQA GCSE Computer Science Paper 2
46 questions · hints · full answers · grading
More questions from this exam
Q01.1Convert the binary number 11010100 into decimal.EasyQ01.2Convert the binary number 10111001 into hexadecimal. You should show your working.MediumQ01.3State the largest decimal number that can be represented using 6 bits.EasyQ02.1Add together the following three binary numbers and give your answer in binary.
00110110
1001...MediumQ02.2Apply a binary shift three places to the right on the bit pattern 10101000. Give the result using...Easy
Expert