Home / Expert Answers / Computer Science / for-each-of-the-source-code-fragments-below-1-construct-the-basis-set-that-is-a-set-of-the-requir-pa135

(Solved): For each of the source code fragments below 1) Construct the basis set, that is, a set of the requir ...



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;
}
}
}



We have an Answer from Expert

View Expert Answer

Expert Answer


#include int main() { int i; i=0; while(i<10) { printf("Enter a number: "); /* 1 */ scanf("%d", &i); /* 2 */ } printf("You entered %d.\r", i); /* 3 */ return 0; /* 4 */ } 2 #include int main() int i = 0; int j = 0; while (i
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe