1
4.4kviews
Consider the following program segment.


# include <stdio.h>
main ()
{ float x, y, z;
clrscr(),
printf( "enter the three variables x, y, z");
scanf( "%f%f" , &x, &y, &z);
if(x>y)
{
printf( "x is greatest");
else
printf ("z is gretest");
}
else
{
if (y > z)
printf ( " y is greatest" ),
else
printf( "z is greatest");
}
getch();
}
1) Draw the decision-to-decision graph or DD graph the above program.
2) Calculate the cyclomatic complexity of the program using all the methods.
3) List all the independent paths.
4) Design test cases from independent paths.

1 Answer
1
261views
  1. Draw decision-to-decision graph or DD graph

    enter image description here

  2. Cyclomatic complexity.

    1] V(G) = e - n + 2(p) = 15 - 13 + 2 = 4

    2] V(G) = Number of predicate nodes + 1 $(P_1, P_2, P_3)$ = 3 + 1 = 4

    3] V(G) = Number of regions = $4 …

Create a free account to keep reading this post.

and 5 others joined a min ago.

Please log in to add an answer.