0
0
Compiler Designknowledge~5 mins

Compiler vs interpreter in Compiler Design - Quick Revision & Key Differences

Choose your learning style9 modes available
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?
ATranslates entire source code before execution
BExecutes code line-by-line
CRuns code without translation
DOnly checks syntax without translation
Which is true about an interpreter?
AIt only compiles code without running
BIt translates code all at once before running
CIt translates and runs code line-by-line
DIt converts machine code back to source code
Which usually results in faster program execution?
AInterpreted code
BCompiled code
CSource code
DUntranslated code
When are errors detected in interpreted programs?
AErrors are not detected
BDuring compilation
CBefore running the program
DDuring execution
Which language is commonly compiled?
AC
BJavaScript
CPython
DHTML
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.