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

Homework #11, Control Flow Coverage For the following program P written in pseud

ID: 3686416 • Letter: H

Question

Homework #11, Control Flow Coverage For the following program P written in pseudo-code, given the test set T: T = {t1 = <7, 2>, t2 = <3, 1>}

7) What is the domain for condition coverage of P?

8) What is the condition coverage for T?

Program P

1) integer X, Y, Z;

2) input (X, Y);

3) if (X<0 or X>8 or Y<1 or Y>3)

4) {

5) output (“Boundary condition failure on inputs.”);

6) } // end input check

7) else

8) {

9) Z = 0;

10) if (X < 5)

11) {

12) Z = X + Y;

13) if (Y == 1)

14) {

15) Z = X ^ 2;

16) } // end if (Y==1)

17) } // end if (X<5)

18) else

19) {

20) Z = Z – X;

21) if (Y == 0)

22) {

23) Z = Z * Z;

24) } // end if (Y==2)

25) else

26) {

27) Z = Z + X;

28) } // end else !(Y==2)

29) } // end else !(X<5)

30) output (X,Y,Z);

31) } // end else legal inputs 32) end;

Explanation / Answer

Answer for Question 1:

the domain for condition coverage of P is

Here If X and Y are the inputs and based on the input
values range checks the below code will hit..

Case 1: if X and Y or above or below 0,8 and 1, 3 set_new_handler

code will fail

Code 2:

If X is less than 5 Z will do once done Y is eqaul to 1

Z = X^2

Case 3:

If Y== 0 Z = Z* Z will hit

Case 4:

otherwise elese condition will Z = Z+ X;
output will be printa

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote