Q: 6
Given the Following program IF X = ZTHEN Statement 2;ENDMcCabe’s Cyclomatic Complexity is :
Options
Discussion
Yeah, I don't think it's C. The main trick is assuming there are multiple paths, but with a single IF statement (no compound logic), cyclomatic complexity is 3. B matches what the formula gives for one decision point. Happy to hear if someone interprets the IF condition differently but pretty sure B is right here.
Option B is correct. There’s only a single IF decision here, so complexity is 3 (number of decision points plus 1). Option D would be if there were more branches or compound conditions, but that isn’t the case with this code. Pretty sure that’s how McCabe goes-correct me if I missed something!
C imo, since the IF condition has a weird operator (=) and it kind of looks like compound logic. Normally single IF is 3, but maybe they're counting this as an extra branch? Not totally sure, open to being corrected if I'm missing something basic.
B tbh, since only one independent path plus entry/exit so the tricky IF counts once.
Probably B, since there's one decision so cyclomatic complexity is 3. Seen similar in sample questions.
B tbh, encountered exactly similar question in my exam and it's 3 for single IF.
C or B, but I'm going C here since the IF = looks odd and might be counted as two checks. Maybe it's wrong and they're just counting it as one, not sure.
Maybe B. I've seen similar questions pop up in official sample tests and the syllabus, worth double-checking those if unsure.
Pretty sure it's B, since there's just a single IF so one decision point. Cyclomatic complexity for that is usually 3 unless there's some hidden compound logic. Open to other views if I'm missing something.
Not sure C is right, trap is thinking multiple conditions exist in that IF but it's just one.
Be respectful. No spam.