For each of the source code fragments below 1) Construct the basis set, that is, a set of the required number of independent paths through the source code fragment. 2) Construct a path predicate for each independent path. Note: - Refine the code fragment/program graph if there are any decisions comprising compound conditions. - Use line numbers to describe the independent paths. - Use Boolean conditions from the source code to describe the path predicates.
1.
Problem a:
void Q1(){
S1;
if(C1){
S2;
}
S3;
if(C2 OR C3){
S4;
}
else{
S5;
}
S6;
}
Problem b:
void Q2(){
if(C1&&C2){
S1;
}else{
if(C3){
S2;
}else{
S3;
}
while(C4){
S4;
}
S5;
}
}
Problem c:
void Q1(){
for(S1;C1;S2){
while(C2 && C3){
if(C4){
S3;
}
else{
if(C5){
S4;
}
}
}
}
S5;
}
Problem d:
void Q1(){
if(C1){
S1;
while(C2){
if(C3){
S2;
S3;
}
}
}
else{
S4;
while(C4){
S5;
while(C5){
S6;
}
S7;
}
}
}