wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Understanding Compilers and Their Functions

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What is the primary function of a compiler?

a)

To execute code directly

b)

To convert high-level code into machine code

c)

To interpret code line by line

d)

To debug code

2.

Which of the following is the first stage of the compilation process?

a)

Syntax Analysis

b)

Semantic Analysis

c)

Lexical Analysis

d)

Code Generation

3.

During which stage of the compilation process are tokens analysed according to grammatical rules?

a)

Lexical Analysis

b)

Syntax Analysis

c)

Semantic Analysis

d)

Code Linking

4.

What is the purpose of semantic analysis in the compilation process?

a)

To optimise the code

b)

To check for semantic errors

c)

To generate machine code

d)

To link code modules

5.

Which stage of the compilation process involves improving performance and efficiency of the code?

a)

Code Generation

b)

Lexical Analysis

c)

Optimisation

d)

Code Linking

6.

What is the final stage of the compilation process?

a)

Code Generation

b)

Code Linking

c)

Semantic Analysis

d)

Syntax Analysis

7.

In which stage is the source code broken down into the smallest units of meaning?

a)

Syntax Analysis

b)

Lexical Analysis

c)

Code Generation

d)

Optimisation

8.

What is created during the syntax analysis stage?

a)

Machine code

b)

Tokens

c)

Syntax tree

d)

Executable program

9.

Which of the following is NOT a high-level programming language mentioned in the overview?

a)

C

b)

C++

c)

Java

d)

Python

10.

What does the code generation stage produce?

a)

Tokens

b)

Syntax tree

c)

Machine code

d)

Executable program

11.

Which stage involves linking machine code with other code modules and libraries?

a)

Code Generation

b)

Code Linking

c)

Semantic Analysis

d)

Optimisation

12.

What is the role of a compiler in programming?

a)

To execute machine code

b)

To translate high-level code into machine code

c)

To interpret high-level code

d)

To debug machine code

13.

Which of the following is a type of error checked during semantic analysis?

a)

Syntax error

b)

Logical error

c)

Semantic error

d)

Runtime error

14.

What is the main purpose of code optimisation?

a)

To check for syntax errors

b)

To improve code readability

c)

To enhance code performance and efficiency

d)

To generate tokens

15.

Which of the following is NOT a stage in the compilation process?

a)

Lexical Analysis

b)

Syntax Analysis

c)

Debugging

d)

Code Linking