Professional Documents
Culture Documents
FACULTY OF ENGINEERING
MAY/JUNE 2013
INSTRUCTIONS TO CANDIDATES
Question 1
(a) (i) Give definitions of the terms fault and failure as they are understood in the
fault-tolerant computing community, that indicate the difference between the two
terms.
[2 marks]
(b) (i) Give definitions of the terms test driver and stub as they are understood in
the context of unit software testing.
[2 marks]
(ii) What is the difference between the top-down and the bottom-up
integration testing approaches?
[4 marks]
(d) Explain each of the stages of the Testing life cycle model listed below and give one
expected deliverable for each stage.
Test planning
Test Case development
[4 marks]
(e) The PrimeSieve code has been written by a programmer to generate the Prime
Number series, but the programmer has left a number of mistakes. List six checks
that may be useful in an inspection checklist for identifying mistakes made by the
programmer in the code.
Page 1 of 9
SOFTWARE TESTING & QUALITY ASSURANCE – CSE 3019(5)
Question 1 - (continued)
if (isPrime[i]) {
for (int j = i; i*j <= N; j++) {
isPrime[i*j] = false;
}
}
// count primes
int primes = 1;
for (int i = 2; i <= N; i++) {
if (isPrime[i]) primes++;
}
System.out.println("The number of primes <= " + N + " is " +
prime);
}
}
[6 marks]
Question 2
LRS@MU which provides Light Railway facilities throughout Mauritius has decided to
introduce a new ticket vending machine and a new card system. There are three options
available for the vending machine: Buy a Railcard, Reload card and Notify lost card. In
order to purchase a card; a user should register with the system by entering:
(a) (i) Identify the different equivalent classes for the registration process.
[7 marks]
(ii) Derive a set of eight black box test cases for the registration process.
[4 marks]
(iii) Briefly explain how Boundary Value Analysis (BVA) is different from
Equivalence partitioning.
[2 marks]
Page 2 of 9
SOFTWARE TESTING & QUALITY ASSURANCE – CSE 3019(5)
Question 2- (continued)
(b) You have been requested to generate the test cases for the use case ‘Reload Card’
from the ticket vending machine. The basic flow is as follows:
B1: Select “Reload Card” from the Vending Machine’s display menu.
B2: Tap your Card on the vending machine reader.
B3: Select the value you would like to place on your card by pressing the corresponding
button(s) on the menu screen.
B4: Insert payment into the appropriate slot - cash, coins.
B5: Tap your Card on the card reader a second time to load the value onto your card.
(i) Develop a scenario matrix for ‘Reload Card” with scenario name, starting
flow, alternate flows…( consisting of four different scenarios).
[4 marks]
(ii) Construct the test case matrix consisting of four different test scenarios and
choosing appropriate Data/Conditions header to fill the columns.
(c) Another possible technique that could be used to test the vending machine is the
decision table technique. Briefly explain how you will go about drawing a
decision table for the vending machine elaborating on the possible conditions and
possible actions.
[4 marks]
Page 3 of 9
SOFTWARE TESTING & QUALITY ASSURANCE – CSE 3019(5)
Question 3
(a) Explain why white box testing is an important step in software development?
[2 marks]
(b) A tester has drawn a CFG for the code snippet in Figure 1. Explain with respect to
the code snippet, faults that he might not identify using path testing.
[4 marks]
return s/t;
double kineticEnergy(){
//
//codes to ask user to input values for distance, time and
//mass
//
Figure 1
(c) Consider the codes for a particular module evaluateBuySell( ) (Figure 2, page 6).
(ii). Compute the Cyclomatic complexity for the CFG you have drawn. Identify
the independent paths.
[1 + 4 marks]
Page 4 of 9
SOFTWARE TESTING & QUALITY ASSURANCE – CSE 3019(5)
Question 3- (continued)
boolean evaluateBuySell () {
while (c2) {
s9; s10;
switch (c3) {
case-A:
s20; s21; s22;
break; // End of Case-A
case-B:
s30; s31;
else {s35;}
case-C:
s40; s41;
break; // End of Case-C
case-D:
s50;
break; // End of Case-D
} // End Switch
s60;
s61;
s62;
s80;
s81;
} // End While
s90;
s91;
s92;
return result;
}
Figure 2
(continued next page)
Page 5 of 9
SOFTWARE TESTING & QUALITY ASSURANCE – CSE 3019(5)
Question 3- (continued)
(i). Explain with the help of an example what is meant by test coverage.
[2 marks]
(ii). Consider the following code snippet:
if (a>0){
x = x + 1;
}
if (b==3){
y=0;
}
By defining suitable test data for the above code, explain what is meant by:
Statement Coverage
Branch Coverage
[2 + 2 marks]
Question 4
(a) Software metrics may be broadly classified as either product metrics or process
metrics. What is the difference between process metrics and product metrics?
Give two examples of each.
[2+2 marks]
(b) There are a number of quality models and each one of these quality models
consists of a number of quality characteristics. Consider the McCall’s quality
model and the ISO 9126 quality model and give 3 differences between them.
[6 marks]
(c) ISO 9126-1:2001 talks about Portability and Quality model for Quality in use.
Portability is described as the capability of the software product to be transferred
from one environment to another. The environment may include organizational,
hardware or software environment. What are the 5 key Sub-characteristics of
portability?
[5 marks]
(e) The focus of the Cleanroom process is on defect prevention, rather than defect
removal, explain two techniques used in Cleanroom development to achieve this.
And give two reasons why Cleanroom development is not widely used in
software industries.
[3+2 marks]
Page 6 of 9
SOFTWARE TESTING & QUALITY ASSURANCE – CSE 3019(5)
Question 5
(a) Consider the following java code that to manipulate a list of integers.
public ArrayListSample(){
testArray = new ArrayList<Integer>(Arrays.asList(3, 1, 4, 1,
5));
}
public void add(int x){
testArray.add(x);
}
public void remove(int x){
testArray.remove(new Integer(x));
}
(i) Write a Junit test to check the add method when the parameter is 9.
[3 marks]
(ii) Write a Junit test to check the remove method when the parameter is 5.
[3 marks]
(iii) Write a Junit test to check the getindexOf method when the parameter is
4.
[2 marks]
Question 5 - (continued)
(b) The figure below depicts the State Transition Diagram for an Airline Reservation
System.
payMoney
Made
Paid
giveInfo / cancel
StartPayTimer
PayTime
Expires
Cancel/
Refund
Cancelled Cancelled
NonPay by Cust
Figure 3
Customers make reservations by providing information (date travel, Country to
visit…). The system creates and starts a timer. Each reservation has certain rules
about when the reservation must be paid for. These rules are based on
destination, class of service, dates, etc. If this timer expires before the reservation
is paid for, the reservation is cancelled by the system. At any time, before
reservation expires or when the ticket has been paid for, the customer can cancel
the reservation and in case of ticket being paid, a refund can be asked after
cancellation. The table below describes the different events and actions triggering
state transitions.
Type Description
giveInfo Event Information input to the system by
customer to reserve flight
payMoney Event Customer pays for the ticket
cancel Event Customer cancels reservation or
payment
PayTimerExpires Event Time for keeping reservation
StartPayTimer Action Timer
Refund Action Refunding money
(i) Generate a set of test cases to test all valid transitions (using table format
given below).
(ii) Briefly explain how you check the Cancel button for the Airline Reservation
system. [3 marks]
Question 5- (continued)
c) A particular application for a basic digital camera offers the user the following
options:
Choose an appropriate orthogonal array from the list below and write down the
test cases that must be executed.
[7 marks]
/sg
Page 9 of 9