Question:medium

In the context of code optimization, "Loop Invariant Code Motion" refers to:

Show Hint

To safely move a computation outside a loop, the compiler must ensure that the statement is not inside a conditional branch that might skip it, and that the variables involved are not modified anywhere within the loop body.
Updated On: Jul 4, 2026
  • Removing loops that never execute.
  • Moving computations that yield the same result regardless of the loop iteration outside the loop.
  • Replacing expensive operations with cheaper ones inside a loop.
  • Combining two loops into a single loop.
Show Solution

The Correct Option is B

Solution and Explanation

Was this answer helpful?
0

Top Questions on Regular expressions and finite automata