Consider the following C program. b = c * d; e = c + 1; if (e < 10) { t1 = 2 *…

2025

Consider the following C program.

b = c * d;

e = c + 1;

if (e < 10)

{

t1 = 2 * d;

}

else

{

t1 = e / 2;

}

  1. A.

    Constant folding

  2. B.

    Constant propagation

  3. C.

    Dead code elimination

  4. D.

    None of the above

Attempted by 27 students.

Show answer & explanation

Correct answer: C

This code snippet performs arithmetic operations and conditional assignment. Without subsequent usage of variables b, e, or t1, a compiler may apply Dead Code Elimination to remove these computations entirely. Constant propagation is not possible here due to unknown variable values.

Explore the full course: Mppsc Assistant Professor