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

📅  最后修改于: 2021-06-29 02:25:58             🧑  作者: Mango

考虑下面的C代码段。

for (i = 0, i

以下哪一项是错误的?
(一)代码包含循环不变性计算
(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.

这个问题的测验