Replacing the expression 4*2.14 by 8.56 is known as
- AOption (a)
Constant folding
- BOption (b)
Induction variable
- COption (c)
Strength reduction
- DOption (d)
Code reduction
View answer & explanationHide answer & explanation
Correct answer
Constant folding
Why this answer is correct
Concepts:
Constant folding is compiler optimizations technique used by many modern compilers.
Constant folding is the process of recognizing and evaluating constant expressions at compile time rather than computing them at runtime.
Example:
int var = 4*2.14;
Replace with
int var = 8.56
Since multiplication is costly operation, it has been replaced constant which is more optimized version of previous code