if(a>b && b>c){…}. Identify the Mc cabe's number for the given conditional construct
Select one:
a. 3
b. 1
c. 2
d. 5
Answers
Answered by
9
Answer:
Correct Answer is 3 option a
Answered by
1
Option a) 3
if(a>b && b>c){…}.
the cyclomatic complexity of above code=2+1=3,
- McCabe's graph is made up of fundamental building elements, thus I can combine several statements into one as long as control moves between them linearly.
- I viewed your code as a straightforward method with a single entrance point and exit point.
- An exit point is inserted as a sink at the conclusion. Noting that there aren't many examples that I can think of that create graphs from McCabe computations' source code, but I feel like this makes sense given what the fundamental building pieces are and what nodes and edges are supposed to imply.
- Edge between exit and entry point is solely important for streamlining complexity computing, hence the note and several markings (color, arrow).
- Basic blocks are separated by instructions like while, for, if, etc. that have the potential to pass control non-linearly.
- Citing McCabe, AND and OR increase complexity by one because they essentially consist of two if statements: if and if and if or if. Consequently, my second node is a distinct node.
#SPJ2
Similar questions