DUMMY EXAM PAPER
BSc, MSci, MSc
6CCS3SMT, 7CCSMASE
Software Measurement and Testing, Advanced Software Engineering
January 2015 (Period 1)
Rubric ANSWER ALL THREE QUESTIONS.
Books, notes or other written material may not be brought into this
examination.
ANSWER EACH QUESTION IN A SEPARATE ANSWER BOOK AND WRITE ITS NUMBER ON THE COVER
Calculators Calculators may be used. The following models are permitted: Casio fx83 / Casio fx85
Degree Programmes
Module Code Module Title
Examination Period Time Allowed 2 hours
King¡¯s College London ý 2014
6CCS3SMT Software Measurement and Testing
Question 1 Part A
Give the definitions of three measurement scale types and their averages.
[7 marks]
Part B
What is commonly used as a measure of effectiveness of the testing process? Give two advantages and two disadvantages of this measure.
[7 marks]
Part C
(a) What type of testing can we do for third-party components (when the source code is unknown)? (4 marks)
(b) If a source code is not known, but the control flow graph of the program is known, what type of testing can we do? Describe one suitable coverage criterion and ways to achieve maximal coverage. (4 marks)
(c) Is 100% statement coverage enough, in general? If yes, explain. If no, give an example (pseudo-code) where 100% statement coverage misses a fault. (4 marks)
(d) Give the definition of an appropriate coverage criterion for your test suite that ensures that the fault is caught.
(4 marks)
(e) Give a minimal testing suite that catches the fault in your example. (4 marks)
[20 marks]
SEE NEXT PAGE
2
(7 marks)
6CCS3SMT Software Measurement and Testing
Question 2 Part A
(a) What is abstraction? Are all faults found in an abstract model real ones? (5 marks)
(b) Give the definition of Dataflow testing. What is it used for? Give one example of a fault that can be found using dataflow testing. (5 marks)
(c) Give the definition of regression testing. Where is it used and why is it important? (5 marks)
(d) Give the definition of combinatorial testing. Describe two possible coverage criteria for combinatorial testing. (5 marks)
[20 marks]
Part B
(a) Write a formal specification in linear temporal logic for the property ¦Õ = ¡°always if (x>0) then sometimes in the future (y>0)¡±.
Draw an infinite execution (with a loop) that satisfies this property and an infinite execution (with a loop) that is a counterexample. (7 marks)
(d) Write a formal specification in temporal logic for the property
¦Ð = ¡°h (height) is always a non-negative number.¡± How is this type of property called? How does a counterexample to this property look like? Draw a counterexample and a trace that satisfies the property.
3
SEE NEXT PAGE
[14 marks]
Question 3
Consider the following program.
1. 2. 3. 4. 5. 6. 7. 8. 10. 11. 12. 13. 14. 15. 16. 17. 18.
main() {
int x = input();
if(x>0){ draw(circle);
} else{
draw(triangle); }
if (x > 0){
draw(ellipse); }
else{ draw(square);
}
return; }
Part A
(a) Draw the Control Flow Graph for the program. (b) What is the cyclomatic complexity of the graph?
Part B
(5 marks) (4 marks)
[9 marks]
6CCS3SMT Software Measurement and Testing
How many paths does the graph have? Do all of them correspond to feasible executions of the program? Give one test case for each feasible path and for each infeasible path explain why it is infeasible.
Part C
4
SEE NEXT PAGE
[10 marks]
6CCS3SMT Software Measurement and Testing
(a) Is it always possible to achieve 100% statement coverage? Explain your answer. (7 marks)
(b) Is it always possible to achieve 100% branch coverage if 100% state coverage is achievable? Explain your answer. (7 marks)
[14 marks]
5
S E E N EFXI NT APLA GP AE G E