For each of the source code fragments below 1) Construct the basis set, that is, a set of the required number of indepen
Posted: Tue Jul 12, 2022 8:15 am
For each of the source code fragments below 1) Construct thebasis set, that is, a set of the required number of independentpaths through the source code fragment. 2) Construct a pathpredicate for each independent path. Note: - Refine the codefragment/program graph if there are any decisions comprisingcompound conditions. - Use line numbers to describe the independentpaths. - Use Boolean conditions from the source code to describethe 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;}}}
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;}}}