Cyclomatic Complexity of Nested Conditionals
The following code segment uses a nested conditional structure to determine a student’s academic status.
IF (credits >= 90)
IF (gpa >= 2.0)
status = “Senior in good standing”
ELSE
status = “Senior on probation”
ELSE IF (credits >= 60)
IF (gpa >= 2.0)
status = “Junior in good standing”
ELSE
status = “Junior on probation”
What is the cyclomatic complexity of this code segment?
A
4
B
6
C
5
D
3
Question Leaderboard
Not enough data yet to show leaderboard.
