You wrote a bus fare app. What does your friend's laptop need to run it?
Your bus fare app works on your laptop in Leeds. Now a friend wants to run it on theirs. Do you send the code you typed or a ready-to-run file? That depends on how you run the program.
Start with the assembly instructions you write. An assembler translates each assembly instruction into one machine-code instruction. Machine code is made of binary instructions. The processor can execute them directly, as long as they belong to the instruction set that the processor understands.
High-level code is easier to read and write. You can often use the same source on different systems. You’d use it for a fare app. Low-level code gives you more direct control of the hardware. It depends on the processor’s instruction set. You might use assembly for a hardware control routine.
The whole high-level program goes in. The processor can’t run that source code directly, so a compiler translates it before execution. That gives you an executable file containing machine code. When you launch it on a compatible computer, the processor executes its instructions.
You’ve built a machine-code executable and sent it to your friend. Their computer is compatible, and the file is ready to run. What does their computer do when they launch it? Pick one answer.
You start with high-level statements. An interpreter deals with one statement at a time, as it is reached. It uses its own machine-code routines to carry out that statement. Your program runs without the interpreter creating a separate executable for it.
All the amounts are in pounds. The interpreter carries out the first statement, storing three plus one in total. That gives four. It carries out the print statement, displaying four. If you compile instead, both statements are translated before the program runs. Launch the executable and you get four again.
You change the fare to five pounds and the booking fee to two pounds. The program adds them and prints the total. If you run it with an interpreter, what happens? Pick the answer that gets both details right.
A compiler translates the whole program before it runs and produces a separate executable. An interpreter uses its own machine-code routines while your program runs. It does not save a separate executable for your program. You can see the same output either way.