📜  门| GATE-CS-2006 |第 60 题

📅  最后修改于: 2021-09-25 04:30:35             🧑  作者: Mango

考虑以下 C 代码段。

for (i = 0, i

以下哪一项是错误的?
(A)代码包含循环不变计算
(B)此代码中存在公共子表达式消除范围
(C)本规范存在强度降低的范围
(D)这段代码有死代码消除的范围答案: (D)
说明:问题询问虚假陈述

4*j is common subexpression elimination so B is true.

5*i can be moved out of inner loop so can be i%2. 
Means, A is true as we have loop invariant computation.

Next, 4*j as well as 5*i can be replaced with a = - 4;
before j loop then a = a + 4; where 4*j is computed,
likewise for 5*i. C is true as there is scope of strength 
reduction. 

By choice elimination, we have D.

这个问题的测验