Data-Communication
December 12, 2023Software-Engineering
December 12, 2023ISRO CS 2014
Question 4
|
Consider the following pseudo code
while (m < n)
if (x > y ) and (a < b) then
a=a+1
y=y-1
end if
m=m+1
end while
What is cyclomatic complexity of the above pseudo code?
while (m < n)
if (x > y ) and (a < b) then
a=a+1
y=y-1
end if
m=m+1
end while
What is cyclomatic complexity of the above pseudo code?
2
|
|
3
|
|
4
|
|
5
|
Question 4 Explanation:
Finding cyclomatic complexity using 3 formulas
1. E-V+2
2. P+1
3. No.of Regions
According to above code segment.
→ Edges-Vertices+2
= 8-6+2 = 4
→ Total number of regions = 4
→ Predicates+1 = 3+1 = 4
Note: We can use any one of above formulas.
1. E-V+2
2. P+1
3. No.of Regions
According to above code segment.
→ Edges-Vertices+2
= 8-6+2 = 4
→ Total number of regions = 4
→ Predicates+1 = 3+1 = 4
Note: We can use any one of above formulas.
Correct Answer: C
Question 4 Explanation:
Finding cyclomatic complexity using 3 formulas
1. E-V+2
2. P+1
3. No.of Regions
According to above code segment.
→ Edges-Vertices+2
= 8-6+2 = 4
→ Total number of regions = 4
→ Predicates+1 = 3+1 = 4
Note: We can use any one of above formulas.
1. E-V+2
2. P+1
3. No.of Regions
According to above code segment.
→ Edges-Vertices+2
= 8-6+2 = 4
→ Total number of regions = 4
→ Predicates+1 = 3+1 = 4
Note: We can use any one of above formulas.