Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For the program given below: (a) Draw the Control Flow Graph (CFG) (b) Find its

ID: 3827212 • Letter: F

Question

For the program given below: (a) Draw the Control Flow Graph (CFG) (b) Find its Cyclomatic Complexity (CC). (c) How many test cases are required for each of: 1- Statement testing 2- Branch testing 3- Path testing. 4- Exhaustive testing assuming that the maximum number of records is 5. (Justify your answers). (d) Give an example set for test cases of the branch testing. Program Q4 A = 0; B = 0; Read new_rec; {read a new record (X, Y)} Repeat While A > = 0 OR B > = 0 Do If (A 0 Then Print A, X Else Print B, Y Endif Read new_rec; End.

Explanation / Answer

Statement Testing : 1
with at least 1 test case we can test all the statements and conditions of the program.

Branch testing : 2
with at least two branch test case we can check all the decision statements.

Path Testing : 2
with at least two path test case we can check all the paths of the program.

Exhaustive Testing (assuming that the maximum number of records is 5) : 4
we will require atleast 4 test case to perform exhaustive testing because value of X & Y can have 2 possible combination of values individually ie either greater than or equal to 0 or less than 0.