COMPILER DESIGN

INTRODUCTION TO COMPILER DESIGN

COMPILATION PROCESS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What is the purpose of the optimisation stage of compilation?
A
Reduce execution time
B
Reduce inefficient sections of code
C
Remove redundant code
D
Tokens are compared to the rules of the programming language
E
Syntax errors are identified
Explanation: 

Detailed explanation-1: -The optimiser may identify redundant or repeated code, and remove or rearrange the code as necessary. This ensures the code runs as fast as possible.

Detailed explanation-2: -i.e. code optimization allows consumption of fewer resources. (i.e. CPU, Memory), which results in faster running machine code. Optimized code also uses memory efficiently. The optimization must be correct, it must not, in any way, change the meaning of the program.

Detailed explanation-3: -Code optimization is an optional phase. It is used to improve the intermediate code so that the output of the program could run faster and take less space. It removes the unnecessary lines of the code and arranges the sequence of statements in order to speed up the program execution.

Detailed explanation-4: -Code optimization is any method of code modification to improve code quality and efficiency. A program may be optimized so that it becomes a smaller size, consumes less memory, executes more rapidly, or performs fewer input/output operations.

There is 1 question to complete.