edited by
621 views
1 votes
1 votes

Consider these two functions and two statements $\text{S1}$ and $\text{S2}$ about them. 

int work1(int *a, int i, int j)
{
int x = a[i+2];
a[j] = x+1;
return a[i+2] - 3;
}
int work2(int *a, int i, int j)
{
int t1 = i+2;
int t2 = a[t1];
a[j] = t2+1;
return t2 - 3;
}

$\text{S1:}$ The transformation form 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$

$\text{S2:}$ All the transformations applied to work$1$ to get work$2$ will always improve the performance (i.e reduce $\text{CPU}$ time) of work$2$ compared to work$1$

  1. $\text{S1}$ is false and $\text{S2}$ is false
  2. $\text{S1}$ is false and $\text{S2}$ is true
  3. $\text{S1}$ is true and $\text{S2}$ is false
  4. $\text{S1}$ is true and $\text{S2}$ is true
edited by

Please log in or register to answer this question.

Answer:

Related questions

1 votes
1 votes
0 answers
4
soujanyareddy13 asked Apr 12, 2022
896 views
Match the following:$$\begin{array} {ll} \qquad \quad\textbf{List-I} & \qquad \quad \textbf{List-II} \\ \text{(P) Condition coverage} & \text{(1) Black-box testing} \\ \t...