Question
[Verification and Validation] Consider the program and the graph above. Suppose we would like to design a test suite for the program based data-flow analysis.
[Verification and Validation]
Consider the program and the graph above. Suppose we would like to design a test suite for the program based data-flow analysis. For simplicity, we shall perform a data-flow analysis with respect to the variables a and b only, i.e. we shall omit the variables scores and i from the analysis.
1) From the control flow graph in Figure 1, find Def(n) and Use(n) for each node n in the graph. Note that
Def(n) = the set of variables which are defined (i.e. they are assigned some values) at node n.
Use(n) = the set of variables which are accessed (i.e. their values are read) at node n.
2) Is there a test suite which satisfies All-Defs coverage? If there is one, describe such a test suite. If not, explain why there is no test suite which satisfies All-Defs coverage and then describes a test suite which has the highest degree of All-Defs coverage.
3) Is there a test suite which satisfies All-Uses coverage? If there is one, describe such a test suite. If not, explain why there is no test suite which satisfies All-Uses coverage and then describes a test suite which has the highest degree of All-Uses coverage.
1: int sumOfTopTwo (int[] scores) int a = -1, b = -1 if (scores. length = 0) return 0 if scores. length-1) return scores [0]; 8 for(int i = 0; score s.length: 1++) 10: if(scores [1] b) 12: 13: 14: 15: 16: 17: 18: = scores! } else if(scores [i] a) a scores return a+ b; 1: int sumOfTopTwo (int[] scores) int a = -1, b = -1 if (scores. length = 0) return 0 if scores. length-1) return scores [0]; 8 for(int i = 0; score s.length: 1++) 10: if(scores [1] b) 12: 13: 14: 15: 16: 17: 18: = scores! } else if(scores [i] a) a scores return a+ bStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started