Question: | First Function : public class FunctionExample { public int firstFunction ( ) { int counter = ; int outerLimit = 1 0 ; int

|First Function :
public class FunctionExample {
public int firstFunction(){
int counter =;
int outerLimit =10;
int nestedLimit =5;
boolean flag =true;
int secondCounter =0;
for(int i=0;i5){
flag =!flag;
}
}
if(i %2==0){
System.out.printIn("Outer loop even iteration, additional processing...");
}
}
System.out.printin("First function has finished its processing with counter: "+counter);
return counter;
}
second Function:
public int secondFunction(){
int secondCounter =0;
int secondLimit =5;
for(int 1=0; 1secondLimit; l++){
System.out,println("Second function loop iteration:"+1);
secondCounter++;
if(1%2!=0){
System.out.println("Odd iteration in second function.");
}else {
System.out.println("Even iteration in second function.");
}
}
System.out.println("Second function has finished its processing.");
return secondCounter;
}
a)Draw the corresponding Control Flow Graphs for the firstFunclion()and the secondFunclion().Label the nodes of the CFGs with the respective line numbers in the source code. [14points]
b)Draw the prime decomposition trees based on the CFG is for the firstFunction()and the secondFunction().[l2points]
c)How many test cases are needed (at a minimum)to achieve the following coverage criteria for the firstfunction()?[8points]
Statement coverage
Branch coverage
Basis path coverage
Simple path coverage
d)Provide al (partial)paths to achieve all DU path coverage with respect to variable "counter" in the firstfunction().All paths should be defined in terms of nodes traversed in the CFG.[6points]
e)Create the following backward slice S ({counter},26)for the firstfunction(),Simply list the line numbers of the statements to be included in the slice. [5points]
f)please identify source nodes, sink nodes and Module Execution Paths for the firstFunclion ()and the secondFunction ()[6points]
g)Please build a Module-Message path graph based on question f).[5points]
h)Please identify a MM-path based on g)(4points)
| First Function : public class FunctionExample {

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!