Machine-translated by Google. Questions are authored in English.
Top

Discussion

Constant folding is the transformation that

  • A.removes a statement whose result is never used anywhere
  • B.moves a computation right out of a loop that does not ever change it
  • C.works out at compile time the value of an expression built from literals
  • D.replaces a variable by the constant it is known to hold

Answer: C

Correct answer: works out at compile time the value of an expression built from literals

Constant folding evaluates \( 3 \times 4 \) to 12 during compilation. It is distinct from constant propagation, which replaces a variable by a constant known to be in it - the two are almost always run together, each exposing further opportunities for the other.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.