Question: The Java method below calculates the greatest common divisor of two integers ( num 1 , num 2 ) . The valid input range of
The Java method below calculates the greatest common divisor of two integers num num
The valid input range of num and num is specified as follows:
leqnumleqleqnumleq
public static int gcdint num int num
int a num;
int b num;
if a b a b
l
System.out.printlnInvalid input";
return ;
else
int i ;
while a
i;
int temp a;
a b a;
b temp;v
System.out.printlnGCD Calculation required
i iterations";
return b;
a Draw the corresponding Control Flow Graph and label the nodes of the CFG with the respective line numbers in the source code. points
b Draw the prime decomposition tree. points
c How many test cases are needed at a minimum to achieve the following coverage criteria? Please list the identified test cases points
Simple path coverage
Basis path coverage
d Provide provide all partial paths to achieve all DUpath coverage with respect to variable'a All paths should be defined in terms of nodes traversed in the CFG points
e Create the following backward slice $ fb Simply list the line numbers of the statementsto be included in the slice. points
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
