Teaching UGC NET Mock Test Series 2025 (Paper 1 & 2) Compiler Design Code Optimization Loop Optimization
Consider the following code fragment.
int y = 3 * 5int x = y * 1;
float pi = 3.142;
for(int i =0; i < 500; i ++)
{
x = x / pi;
}
boolean flag = FALSE;
if(flag)
{
x = x + 5;
y = y * 6;
x = x + y;
y = y * x;
}
Which of the following optimization techniques can be applied ?
1
Loop unrolling
2
Deadcode elimination
3
Constant Propagation
4
All of the above