You are on page 1of 10

UNIVERSITY OF MAURITIUS

FACULTY OF ENGINEERING

SECOND SEMESTER EXAMINATIONS

MAY/JUNE 2013

PROGRAMME BSc (Hons) Computer Applications – Part-Time


BSc (Hons) Computer Applications – Full-Time
BSc (Hons) Computer Science
BSc (Hons) Information Systems

MODULE NAME Software Testing and Quality Assurance

DATE Thursday MODULE CODE CSE 3019(5)


30 May 2013

TIME 13:30 – 15:30 Hrs DURATION 2 hours

NO. OF 5 NO. OF QUESTIONS 4


QUESTIONS SET TO BE ATTEMPTED

INSTRUCTIONS TO CANDIDATES

Answer any 4 questions.

All questions carry equal marks.


SOFTWARE TESTING & QUALITY ASSURANCE – CSE 3019(5)

Answer any 4 questions.

All questions carry equal marks.

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]

(ii) Explain the difference between verification and validation in software


testing.
[3 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]

(c) Software Inspection refers to review of a work product by trained individuals


who look for defects using a well defined process. Explain the following steps of
software inspection process.
 Overview meeting
 Preparation
 Inspection meeting
 Follow-up
[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.

(continued next page)

Page 1 of 9
SOFTWARE TESTING & QUALITY ASSURANCE – CSE 3019(5)
Question 1 - (continued)

public class PrimeSieve {


public static void main(String[] args) {
int N = Integer.parseInt(args[0]);
int x;
// initially assume all integers are prime
boolean[] isPrime = new boolean[N + 1]
for (int i = 2; i <= N+1; i++) {
isPrime[i] = true;
}

for (int i = 2; i*i <= N; i++) {

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:

 Social security number which is 14 alphanumeric characters.


 Password that must be equal to 8 alphanumeric characters (uppercase
only) without blanks.

(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]

(continued next page)

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.

The alternate Flows:

A1:The user press cancel button.


A2:The amount of money selected is not same as payment inserted.
A3:The user don’t tap the card a second time

(i) Develop a scenario matrix for ‘Reload Card” with scenario name, starting
flow, alternate flows…( consisting of four different scenarios).

Scenario ID Scenario Name Starting First alternate Second


flow alternate

[4 marks]

(ii) Construct the test case matrix consisting of four different test scenarios and
choosing appropriate Data/Conditions header to fill the columns.

Test Scenario Data/condition Data/condition Data/condition Expected


case ID result
[4 marks]

(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]

double velocityCalculator (double s, double t){

return s/t;

double kineticEnergy(){

//
//codes to ask user to input values for distance, time and
//mass
//

double velocity = velocityCalculator (double s, double t)


kineticEnergy = 0.5 * mass * velocity;

// actual formula for kineticEnergy should have been:


// kineticEnergy = 0.5 * mass * velocity * velocity

for (i=1; i<=1000; i++)


for (j=1; j<=1000; j++)
for (k=1; k<=1000; k++)
doSomethingWith(i,j,k);

Figure 1

(c) Consider the codes for a particular module evaluateBuySell( ) (Figure 2, page 6).

(i). Draw the Control Flow Graph for the program.


[8 marks]

(ii). Compute the Cyclomatic complexity for the CFG you have drawn. Identify
the independent paths.
[1 + 4 marks]

(continued next page)

Page 4 of 9
SOFTWARE TESTING & QUALITY ASSURANCE – CSE 3019(5)

Question 3- (continued)

boolean evaluateBuySell () {

s1; s2; s3;

if (c1) {s4; s5; s6;}

else {s7; s8;}

while (c2) {

s9; s10;

switch (c3) {

case-A:
s20; s21; s22;
break; // End of Case-A

case-B:
s30; s31;

if (c4) {s32; s33; s34;}

else {s35;}

break; // End of Case-B

case-C:
s40; s41;
break; // End of Case-C

case-D:
s50;
break; // End of Case-D

} // End Switch

s60;
s61;
s62;

if (c5) {s70; s71;}

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)

(d) Control flow testing defines different levels of test coverage.

(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]

(d) Continuous process improvement is based on many small, evolutionary steps


rather than revolutionary innovations [Imai86]. The Capability Maturity Model
for Software provides a framework for organizing these evolutionary steps into
five maturity levels. Explain the five maturity levels in the CMM model.
[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 class ArrayListSample {


List<Integer> testArray;

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));
}

public int getindexOf(int x){


return (testArray.indexOf(x));
}
public List<Integer>getTestArray(){
return this.testArray;
}

(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]

(continued next page)


Page 7 of 9
SOFTWARE TESTING & QUALITY ASSURANCE – CSE 3019(5)

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).

Current State Event Action Next State


[7 marks]

(ii) Briefly explain how you check the Cancel button for the Airline Reservation
system. [3 marks]

(continued next page)


Page 8 of 9
SOFTWARE TESTING & QUALITY ASSURANCE – CSE 3019(5)

Question 5- (continued)

c) A particular application for a basic digital camera offers the user the following
options:

 Flash (ON, OFF, Auto, Redeye)


 Shooting Mode (HDR, Face, Smile, Panorama)
 Effects (None, Cold Vintage, Warm Vintage, Solarise)
 Focus (Auto, Macro)
 Scene (Portrait, Landscape, Sports, Indoor)

Choose an appropriate orthogonal array from the list below and write down the
test cases that must be executed.

L16(45) L16 (5 4) L8 (25)

11111 1111 11111


12222 1222 21122
13333 1333 12121
14444 1444 11212
21234 1555 22112
22143 2123 21221
23412 2234 12222
24321 2345 22211
31342 2451
32431 2512
33124 3135
34213 3241
41423 3352
42314 3413
43241 3524
44132 4142

[7 marks]

END OF QUESTION PAPER

/sg

Page 9 of 9

You might also like