Structure based testing techniques - MCQs

Structure based testing techniques - MCQs


1. Given the following sample of pseudo code:

01 Input number of Sandwich
02 Input number of Iced tea
03 If Sandwich > 0 and Iced tea > 0 then
04 Input Do you want home delivery (Yes / No)
05 If home delivery = No?
06 Print Serve their order now
07 End if
08 End If

Which of the following test cases will ensure that statement 6 is executed?

a) Sandwich = 1, Iced tea = 1, home delivery = yes
b) Sandwich = 1, Iced tea = 1, home delivery= no
c) Sandwich= 1, Iced tea = 2, home delivery= yes
d) Sandwich= 1, Iced tea = 0, home delivery = no

View Answer / Hide Answer

ANSWER: b




2. If all the statements of code are executed that means every decision is is executed at least once. True or false.

a) True
b) False

View Answer / Hide Answer

ANSWER: b

Comment: 100% statement coverage does not guarantee 100% decision coverage while 100% decision coverage is 100% statement coverage.




3. How many inputs are required for 100% decision coverage?

Read A
Read B

IF A+B > 100 THEN
Print "A+B is Large"
ENDIF
If A > 50 THEN
Print "A Large"
ENDIF

a) 1
b) 2
c) 3
d) 4

View Answer / Hide Answer

ANSWER: b




4. How many inputs are required for 100% statement coverage?

Read customer_name
Read record
If age < 18 then
Print Reject customer
Else
Print accept customer
Endif

a) 1
b) 2
c) 3
d) 4

View Answer / Hide Answer

ANSWER: a




5. Read A,B

If A>=2
Print A+B
else
Print A-B
EndIf
If B<1
Print B-A
End

For the above algorithm what will be the minimum number of test cases required to achieve 100% statement and decision coverage?

a) SC=2,DC=2
b) SC=1,DC=3
c) SC=2,DC=3
d) SC=3,DC=3

View Answer / Hide Answer

ANSWER: a




6. What is Cyclomatic complexity?

a) Black box testing
b) White box testing
c) Grey box testing
d) Combination of all


View Answer / Hide Answer

ANSWER: b

Comment: Cyclomatic complexity gives the minimum number of paths that can generate all possible paths through the module. As it requires knowledge of internal logic it is white box testing.




7. Which of the following is/are structural testing technique?

a) Statement Coverage
b) Decision Coverage
c) Condition Coverage
d) Path Coverage
e) All of these

View Answer / Hide Answer

ANSWER: e


Post your comment