Question
QA questions a. Select minimum number of test cases to achieve 100% statement coverage in ReturnAverage() b. Select minimum number of paths to achieve 100%
QA questions
a. Select minimum number of test cases to achieve 100% statement coverage in ReturnAverage()
b. Select minimum number of paths to achieve 100% branch coverage in ReturnAverage()
/* Function: ReturnAverage computes the average of all those numbers in the input array in the positive range [MIN, MAX]. The maximum size of the array is AS. But, the array size could be smaller than AS in which case the end of input is represented by -999. */
public static double ReturnAverage(int value[], int AS, int MIN, int MAX){
int i, ti, tv, sum;
double av;
i = 0; ti = 0; tv = 0; sum = 0;
while (ti < AS && value[i] != -999) {
ti++;
if (value[i] >= MIN && value[i] <= MAX) {
tv++;
sum = sum + value[i];
}
i++;
}
if (tv > 0)
av = (double)sum/tv;
else
av = (double) -999;
return (av);
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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