Statement Coverage and Pseudo Code, Question Papers.
1.
Given the following code, which
is true:
Read P
Read Q
IF P+Q > 100 THEN
Print
"Large"
ELSE
IF P+Q
> 50 THEN
Print
"Medium"
ELSE
Print
"Small"
ENDIF
ENDIF
a)
1 test for statement coverage,
3 for branch coverage
b)
2 tests for statement coverage,
2 for branch coverage
c)
2 tests for statement coverage,
3 for branch coverage
d)
3 tests for statement coverage,
3 for branch coverage
e)
3 tests for statement coverage,
2 for branch coverage
2.
Given the following:
Switch PC on
Start “outlook”
IF outlook appears THEN
Send an
email
Close
outlook
a)
1 test for statement coverage,
1 for branch coverage
b)
1 tests for statement coverage,
2 for branch coverage
c)
1 tests for statement coverage,
3 for branch coverage
d)
2 tests for statement coverage,
2 for branch coverage
e)
2 tests for statement coverage,
3 for branch coverage
3.
Given the following code, which
is true:
IF A > B THEN
C = A - B
ELSE
C = A + B
ENDIF
Read D
IF C = D Then
Print “Error”
ENDIF
a)
1 test for statement coverage,
3 for branch coverage
b)
2 tests for statement coverage,
2 for branch coverage
c)
2 tests for statement coverage,
3 for branch coverage
d)
3 tests for statement coverage,
3 for branch coverage
e)
3 tests for statement coverage,
2 for branch coverage
4.
For the following:
If my train ticket is a cheap-day return
Then
catch a train after 9.30am
Otherwise
catch any train
Buy a coffee and enjoy the train journey
a)
CC = 1, SC = 1, BC = 1
b)
CC = 1, SC = 2, BC = 2
c)
CC = 2, SC = 1, BC = 1
d)
CC = 2, SC = 2, BC = 2
e)
CC = 2, SC = 1, BC = 2
5.
For the following pseudo code:
Read A
Read B
IF B = A THEN
Print
“they are the same”
ELSE
Print
“they are different”
ENDIF
a)
CC = 1, SC = 1, BC = 2
b)
CC = 2, SC = 1, BC = 2
c)
CC = 1, SC = 2, BC = 1
d)
CC = 2, SC = 2, BC = 2
e)
CC = 1, SC = 1, BC = 1
6.
Which of the following is
FALSE:
a)
At 100%, statement coverage is
the same as branch coverage.
b)
At 100%, decision coverage is
the same as branch coverage.
c)
At 100%, branch coverage is the
same as decision coverage.
d)
At less than 100% coverage,
branch and decision coverage can be different.
e)
At 100% coverage, branch and
path coverage can be different.
7.
For the following :
Go to the vending machine
If the vending machine is not working
then
call
repair centre to fix
Otherwise
Insert
money
If
enough money is inserted then
Select
a drink
Wait
for drink to be dispensed
Otherwise
Display
message requesting more money
a)
CC = 2, SC = 1, BC = 2
b)
CC = 2, SC = 2, BC = 2
c)
CC = 3, SC = 3, BC = 3
d)
CC = 3, SC = 2, BC = 3
e)
CC = 4, SC = 2, BC = 3
8.
Which of the following is true:
a)
CC >= SC >= BC
b)
SC >= CC >= BC
c)
BC >= CC >= SC
d)
CC >= BC >= SC
e)
BC >= SC >= CC
9.
Consider the following
statements:
1.
CC is a measure of the complexity of the program.
2.
CC is derived by running tests
3.
CC is always measured using a tool
4.
CC can be measured using a tool
5.
CC is a static analysis measurement
a)
1, 2 are true; 3, 4, 5 are
false
b)
1, 2, 3 are true; 4, 5 are
false
c)
1, 2, 3, 4 are true; 5 is false
d)
1, 4, 5 are true; 2, 3 are
false
e)
All the statements are true
10. For the following:
Pick up telephone
Dial number
Wait for reply
Ask to speak to
Managing Director
If the Managing
Director is available
Talk to him about the importance of good
quality testing
Otherwise
Leave a message to phone you back
a)
CC = 1, SC = 1, BC = 2
b)
CC = 1, SC = 2, BC = 2
c)
CC = 2, SC = 1, BC = 2
d)
CC = 2, SC = 2, BC = 2
e)
CC = 2, SC = 2, BC = 3
11. For the following pseudo code:
Questions = 40
Result = (Right / Questions) * 100
IF Result < 61 THEN
print
“FAIL”
X
= 0
ELSE
print
“PASS”
X
= 1
ENDIF
IF X = 0 THEN
Print
“You may retake the exam”
ELSE
Print
“Congratulations!”
Print
“Go to the next level of the course”
ENDIF
a)
CC = 2, SC = 2, BC = 3
b)
CC = 2, SC = 3, BC = 2
c)
CC = 3, SC = 2, BC = 3
d)
CC = 3, SC = 2, BC = 2
e)
CC = 3, SC = 2, BC = 4
12. Consider the following:
Pick up and read the newspaper
Look at what is on television
If there is a program that you are interested
in watching then
switch the television on and watch
the programme
otherwise
continue reading the newspaper
if there is a crossword in the
newspaper then
try
to complete the crossword
a)
SC = 1 and DC = 1
b)
SC = 1 and DC = 2
c)
SC = 1 and DC = 3
d)
SC = 2 and DC = 2
e)
SC = 2 and DC = 3
Answers:
1) D
2) B
3) B
4) D
5) D2) B
3) B
4) D
6) A
7) C
8) D
9) D
10) D
11) D
12) E
My relatives every time say that I am wasting my time here at web, but I know I am getting know-how every day by reading such fastidious articles.
ReplyDeletemy homepage; windows xp registry cleaner