Consider the following program segment: /* sort takes an integer array and sorts it in ascending order*/

Question:

Consider the following program segment:

/* sort takes an integer array and sorts it in ascending order*/

1. void sort (int a [ ], int n) {

2. int i, j;

3. for(i=0;i

4. for(i=i+1;j

5. if(a[i]>a[j])

6. {

7. temp=a[i];

8. a[i]=a[j];

9. a[j]=temp;

10. }

11. }

(a) Draw the program graph for this program segment.

(b) Determine the cyclomatic complexity for this program (show the intermediate steps of your computation).

(c) How is the cyclomatic complexity metric useful?

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Software Testing

ISBN: 9781107012967

1st Edition

Authors: Yogesh Singh

Question Posted: