NEW
Font size
WorksheetsUnderstanding Compilers and Their Functions
Total questions: 15
Worksheet time: 8mins
What is the primary function of a compiler?
To execute code directly
To convert high-level code into machine code
To interpret code line by line
To debug code
Which of the following is the first stage of the compilation process?
Syntax Analysis
Semantic Analysis
Lexical Analysis
Code Generation
During which stage of the compilation process are tokens analysed according to grammatical rules?
Lexical Analysis
Syntax Analysis
Semantic Analysis
Code Linking
What is the purpose of semantic analysis in the compilation process?
To optimise the code
To check for semantic errors
To generate machine code
To link code modules
Which stage of the compilation process involves improving performance and efficiency of the code?
Code Generation
Lexical Analysis
Optimisation
Code Linking
What is the final stage of the compilation process?
Code Generation
Code Linking
Semantic Analysis
Syntax Analysis
In which stage is the source code broken down into the smallest units of meaning?
Syntax Analysis
Lexical Analysis
Code Generation
Optimisation
What is created during the syntax analysis stage?
Machine code
Tokens
Syntax tree
Executable program
Which of the following is NOT a high-level programming language mentioned in the overview?
C
C++
Java
Python
What does the code generation stage produce?
Tokens
Syntax tree
Machine code
Executable program
Which stage involves linking machine code with other code modules and libraries?
Code Generation
Code Linking
Semantic Analysis
Optimisation
What is the role of a compiler in programming?
To execute machine code
To translate high-level code into machine code
To interpret high-level code
To debug machine code
Which of the following is a type of error checked during semantic analysis?
Syntax error
Logical error
Semantic error
Runtime error
What is the main purpose of code optimisation?
To check for syntax errors
To improve code readability
To enhance code performance and efficiency
To generate tokens
Which of the following is NOT a stage in the compilation process?
Lexical Analysis
Syntax Analysis
Debugging
Code Linking
