GATE | GATE-CS-2006 | Question 60
Consider the following C code segment.
Which one of the following is false?
(A) The code contains loop invariant computation
(B) There is scope of common sub-expression elimination in this code
(C) There is scope of strength reduction in this code
(D) There is scope of dead code elimination in this code
Explanation: Question asks about false statement
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.
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.