CS FundamentalsVery hardProduct-company MCQ pattern
Counting each simple condition in a compound boolean expression as a separate decision, what is the cyclomatic complexity of this function?
Counting each simple condition in a compound boolean expression as a separate decision, what is the cyclomatic complexity of this function?
def valid(a, b, c):
if a > 0 and b > 0:
if c > 0:
return True
return False- A. 4
- B. 3
- C. 5
- D. 2
Correct answer: A. 4
Counting decision points: 3 (each if/elif/while/for test, and each 'and'/'or' as a separate condition). Cyclomatic complexity = decisions + 1 = 3 + 1 = 4.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- Counting each simple condition in a compound boolean expression as a separate decision, what is the cyclomatic complexity of this…
- Counting each simple condition in a compound boolean expression as a separate decision, what is the cyclomatic complexity of this…
- A system has these unadjusted function-point counts (standard average complexity weights: EI=4, EO=5, EQ=4, ILF=10, EIF=7): External…
- A system has these unadjusted function-point counts (standard average complexity weights: EI=4, EO=5, EQ=4, ILF=10, EIF=7): External…
- A system has these unadjusted function-point counts (standard average complexity weights: EI=4, EO=5, EQ=4, ILF=10, EIF=7): External…
- A system has these unadjusted function-point counts (standard average complexity weights: EI=4, EO=5, EQ=4, ILF=10, EIF=7): External…