Recall & Review
beginner
What is a compiler?
A compiler is a program that translates the entire source code of a program into machine code before the program runs.
Click to reveal answer
beginner
What is an interpreter?
An interpreter translates and executes the source code line-by-line during program execution.
Click to reveal answer
intermediate
How does a compiler differ from an interpreter in execution speed?
Compiled programs usually run faster because the entire code is translated to machine code beforehand, while interpreted programs run slower as code is translated on the fly.
Click to reveal answer
intermediate
Which type of program (compiler or interpreter) detects errors before running the program?
A compiler detects errors during the compilation process before the program runs, while an interpreter detects errors during execution.
Click to reveal answer
beginner
Give an example of a language typically compiled and one typically interpreted.
C is typically compiled, while Python is typically interpreted.
Click to reveal answer
What does a compiler do?
✗ Incorrect
A compiler translates the entire source code into machine code before running the program.
Which is true about an interpreter?
✗ Incorrect
An interpreter translates and executes code one line at a time during program execution.
Which usually results in faster program execution?
✗ Incorrect
Compiled code runs faster because it is fully translated to machine code before execution.
When are errors detected in interpreted programs?
✗ Incorrect
Interpreters detect errors while running the program, line-by-line.
Which language is commonly compiled?
✗ Incorrect
C is a language that is typically compiled into machine code.
Explain the main difference between a compiler and an interpreter.
Think about when the translation happens and how it affects running the program.
You got /3 concepts.
Describe one advantage and one disadvantage of using an interpreter.
Consider how interpreters handle code and errors.
You got /2 concepts.