Professional Documents
Culture Documents
Structure Based Testing Questions For Classroom v1 1 1 Lyst6453
Structure Based Testing Questions For Classroom v1 1 1 Lyst6453
Read A
Read B
If B = A
then Print “they are the same”
EndIf
Structure Based Test Design
Read A
Read B
If B = A
then Print “they are the same”
Else
Print “they are different”
EndIf
Structure Based Test Design
Read P
Read Q
If P > 50 THEN
Print “P Large”
ENDIF
Structure Based Test Design
Read P
Read Q
Else
If P + Q > 50
Print “Medium”
Else
Print “Small”
EndIf
EndIf
Structure Based Test Design
IF A > B THEN
C=A–B
ELSE
C=A+B
ENDIF
Read D
IF C = D Then
Print “Error”
ENDIF
Structure Based Test Design
Switch PC on
Start “outlook”
IF outlook appears THEN
Send an email
Close outlook
Now decide the minimum number of tests that are needed to ensure that all the
questions have been asked, all combinations have occurred and all replies given.
3
4
5
6
Structure Based Test Design
SC = 1 and DC = 1
SC = 1 and DC = 2
SC = 1 and DC = 3
SC = 2 and DC = 2
SC = 2 and DC = 3
Structure Based Test Design
Read A
Read B
If B > A
then MIN = A
If B = 2 x A
then Print “Bingo!”
EndIF
Else
Min = B
EndIF
Print MIN
Structure Based Test Design
a. 1
b. 2
c. 3
d. 4
Structure Based Test Design
If x=3 then
Display_messageX;
If y=2 then
Display_messageY;
Else
Display_messageZ;
Else
Display_messageZ;
a. 1
b. 2
c. 3
d. 4
Structure Based Test Design
If (p = q)
{ S = S + 1;
If (S < 5)
{ t = 10 }
}
Else if (P > q )
{ T=5 }
A. 3
B. 6
C. 5
D.4
Structure Based Test Design
How many test cases are necessary to cover all the possible
sequences of statements (paths) for the following program
fragment? Assume that the two conditions are independent
of each other: -
if (Condition 1)
then statement 1
else statement 2
if (Condition 2)
then statement 3
a. 2 Test Cases
b. 3 Test Cases
c. 4 Test Cases
d. Not achievable
Structure Based Test Design
5
4
2
3
Structure Based Test Design