Replacing the expression 4∗2⋅14 by 8⋅56 is known as

2019

Replacing the expression 4∗2⋅14 by 8⋅56 is known as

  1. A.

    constant folding

  2. B.

    induction variable

  3. C.

    strength reduction

  4. D.

    code reduction

Attempted by 116 students.

Show answer & explanation

Correct answer: A

Key idea: this transformation is constant folding — evaluating constant expressions at compile time.

  • What constant folding does: compute expressions made only of constants during compilation. Example: 4 * 2 * 14 becomes 112.

  • Important note about the provided replacement: replacing 4 * 2 * 14 by 8 * 56 is incorrect because 8 * 56 = 448, not 112. A correct constant folding replacement would be 112.

  • Why it matters: reduces runtime work, can simplify code for further optimizations, and may reduce generated instructions.

Why the other terms are incorrect:

  • Induction variable: a variable updated in a predictable way each loop iteration (e.g., a loop counter). It is unrelated to compile-time evaluation of constant expressions.

  • Strength reduction: replaces expensive operations with cheaper equivalents (for example, replacing multiplication by addition inside a loop). This is a transformation to reduce operation cost, not to evaluate constants.

  • Code reduction: an imprecise term here. It does not specifically denote evaluating constant expressions at compile time.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor