Question: Question 3 Consider the following method. 1 int computeVal(int x, int y) { 2 z = 0; 3 if (x > y) { 4 if
Question 3
Consider the following method.
1 int computeVal(int x, int y) {
2 z = 0;
3 if (x > y) {
4 if (y > 5) {
5 z = x;
6 } else {
7 z = y;
8 }
9 }
10 if ((z == 4) || (z < 0)) {
11 z = z * x;
12 }
13 if (x <= y) {
14 z = z + 1;
15 } else {
16 z = z 1;
17 }
18 return z;
19 }
Question
i) Provide a simplified flowchart for method computeVal annotated with data flow actions (4 marks)
ii) Provide a minimum number of test cases such that 100% instruction coverage of method computeVal is achieved. (4 marks).
iii) Provide a minimum number of test cases that satisfy the minimum loop coverage of method computeVal. You can re-use test cases from ii) by referring to them. (4 marks).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
