Question: How many test cases are required for 100% statement and branch coverage of the following source code? void main ( ) { int a, b;

How many test cases are required for 100% statement and branch coverage of the following source code?

void main ( )

{

int

a, b;

scanf (“%d”, &a);

scanf (“%d”, &b);

if (a>b) {

printf (“a is large”);

}

else {

printf (“b is large”);

}

}

(a) 1 test case for statement coverage, 2 for branch coverage.

(b) 2 test case for statement coverage, 1 for branch coverage.

(c) 2 test case for statement coverage, 2 for branch coverage.

(d) 1 test case for statement coverage, 3 for branch coverage.

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 Systems Analysis And Design Questions!