bbb20.jpg

Back 

Assemblers, compilers and interpreters questions and answers

Q1. What does an assembler do?
A1. It translates assembly programs into machine code.
Q2. What does an interpreter do?
A2. It takes a program one line at a time, translates the line and runs the line. Then it moves on to the next line. If the translator finds an error, then it stops where it has found the error. It can then be corrected and the program can carry on from that point – there is no need to start the whole translation process again.
Q3. What does a compiler do?
A3. It takes the whole program and translates it in one go into object code. It displays or files away any problems with the syntax of the program. The programmer can then work through these, correcting the errors. The program will have to be recompiled before it can be run.
Q4. Suggest some uses for interpreters.
A4. Interpreters are slower than compilers and you always need the interpreter program as well as the source code, but are great for debugging programs and program development.
Q5. Suggest a use for compiled code.
A5. Compiled code can be distributed on a CD and sold to people. The buyers of the object code cannot actually see the original program and don’t need the compiler to make it run. The object code runs really quickly. 
Q6. What is machine code?
A6. Machine code is the form of a program that a CPU can run.
Q7. What is mnemonic?
A7. A mnemonic is an easily remembered shortened version of something e.g. STO instead of STORE INSTRUCTION
Q8 - Q10. Find out if Python uses interpretation or compilation (HINT: or both?)
A8 - A10. Both. It uses interpretation when developing programs but when you have a working program and want to distribute it, you would compile it into something called Python bytecode. This is code that can't actually run on its own yet. It has to be interpreted first to run. This byte code is very special because interpreters for it exist in all computers, regardless of what web browers and operating systems are being used. In other words, the bytecode isn't designed for any specific machine at all so we say that it is designed to run on a 'virtual' machine, or any machine that exists but one that we don't need to be specific about. Bytecode is also known as 'intermediate code', because it is halfway between interpreted code and compiled code.

Back