Q. 71 Consider these two functions and two statements S1 and S2 about them
intwork1(int*a,inti,intj){intx = a[i+2];a[j] = x+1;returna[i+2] – 3;}intwork2(int*a,inti,intj){intt1 = i+2;intt2 = a[t1];a[j] = t2+1;returnt2 – 3;}
S1 : The transformation from work 1 to work 2 is valid, i.e., for any program state and input arguments, work 2 will compute the same output and have the same effect on program state as work 1 S2 : All the transformations applied to work 1 to get work 2 will always improve the performance (i.e. reduce CPU time) of work 2 compared to work 1
(A) S1 is false and S2 is false
(B) S1 is false and S2 is true
(C) S1 is true and S2 is false
(D) S1 is true and S2 is true
Answer: (A)
Explanation:












