Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

ISRO | ISRO CS 2020 | Question 57

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Consider the following pseudo-code:

I = 0; J = 0; K = 8;
 while (I < K – 1) //while-1
 {
   J = J + 1;
   while (J < K) //while-2
   {
    if (x[I] < x[J])
    {
     temp = x[I];
     x[I] = x[J];
     x[J] = temp;
    }
   } // end of while-2
  I = I +1;
} // end of while-1 

The cyclomatic complexity of the above is
(A) 3
(B) 2
(C) 4
(D) 1


Answer: (C)

Explanation: Cyclomatic complexity of a code section is the quantitative measure of the number of linearly independent paths in it.

There are two while loop, for each there is two possible paths, either true or false.

So, total cyclomatic complexity is = 2*2 = 4 which is answer.

Quiz of this Question

My Personal Notes arrow_drop_up
Last Updated : 09 Sep, 2020
Like Article
Save Article
Similar Reads