# Thread: McCabe’s Cyclomatic Complexity-An ISTQB Question

1. ## McCabe’s Cyclomatic Complexity-An ISTQB Question

Dear All,

I am confused in the below ISTQB question, please explain me with proper answer:-

Q. Given the Following program
IF X &lt;&gt;= Z
THEN Statement 2;
END
McCabe’s Cyclomatic Complexity is :
A. 2
B. 3
C. 4
D. 5

Regards,

2. ## Re: McCabe’s Cyclomatic Complexity-An ISTQB Question

Sounds like the boogy man is after you and the answer to this question will ward him off!

First of all (IF X &lt;&gt;= Z) is usually written (IF X &lt;&gt; Z) the "=" sign does not make sense to me unless there is an implied "OR" there. But it would appear that there would be a node which examines "X &gt; Y" and a node for "X &lt; Y" and in your statement one for "X = Y". which would indicate the answer might be "3".

Maybe you should read up on McCabe.

3. ## Re: McCabe’s Cyclomatic Complexity-An ISTQB Question

This is one reason certifications leave such a bad taste in everyone's mouths. Instead of understanding the question and the value, we just memorize answers to questions.

http://en.wikipedia.org/wiki/Cyclomatic_complexity

4. ## Re: McCabe’s Cyclomatic Complexity-An ISTQB Question

Rich is right. The relational operator (&lt;&gt;=) in the conditional expression does not appear to be a valid relational operator. The &lt;&gt; relational operator in BASIC like languages means 'not equal'.

So, assuming this is a BASIC like language and you have 1 boolean conditional expression. Essentially you have 2 nodes (the Boolean condition and the exit point) and 2 edges (the true and the false outcome of the Boolean condition). So, edges - nodes + 2 = 2. An easy way to calculate cyclomatic complexity is to count the number of Boolean conditions and add 1.

Most training I know is not simply about the ability to calculate cyclomatic complexity, but how to interpret what that metric might imply in terms of risk, and also help testers who design white-box structural tests (esp. basis path tests).

5. ## Re: McCabe’s Cyclomatic Complexity-An ISTQB Question

Thanks Rich and Bj for suggesting me on this.

Pat - I agree with you.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.