ECE 322 Assignment #5 SOLUTION


Rate this product

ECE 322
Assignment #5
Total: 40 points
10 points
1.For the code shown below, draw a control flow graph and determine its cyclomatic
complexity. Consider two situations:
(a)when compound decisions (such as those shown in lines 4, 9, and 11) are treated en
(b)when the individual conditions in the compound decisions are treated separately.
1 output (“Enter 3 integers”)
2 input (a, b, c)
3 output(“Side a,b c: “, a, b, c)
4 if (a < b) and (b < a+c) and (c < a+b)
5 then isTriangle ← true
6 else isTriangle ← false
7 fi
8 if isTriangle
9 then if (a = b) and (b = c)
10 then output (“equilateral”)
11 else if (a ≠ b ) and ( a ≠ c ) and ( b ≠ c)
12 then output (“scalene”)
13 else output(“isosceles”)
14 fi
15 fi
16 else output (“not a triangle”)
17 fi
10 points
Page 2 of 2
2.For the piece of code shown below show def-clear paths for the variables tv, av, and
10 points
3. Write a function in Python such that the all-uses coverage criterion produces more test
cases than the branch coverage criterion.
10 points
4.Using the modified condition/branch coverage criterion, propose test cases for the
following expression
(a || b) && (not(c) || not(d))
Note that the test set is not unique; show all possibilities.


There are no reviews yet.

Be the first to review “ECE 322 Assignment #5 SOLUTION”

Your email address will not be published. Required fields are marked *

Scroll to Top