Open In App

GATE | GATE-IT-2004 | Question 69

Consider the following program module:

int module1 (int x, int y) {
    while (x! = y) {
        if (x > y)
             x = x - y,
        else y = y - x;
        }
    return x;
}

What is Cyclomatic complexity of the above module?
(A) 1
(B) 2
(C) 3
(D) 4

Answer: (C)
Explanation: Condition nodes :



1.While

2. if



Cyclomatic Complexity=2+1=3

 
Quiz of this Question

Article Tags :