You are on page 1of 20

INTERNAL/

EXTERNAL
Semester One, 2017

Unit Code and Title CSI3105 Software Testing SAMPLE EXAM

Student Number SURNAME/FAMILY NAME OTHER OR GIVEN NAME/S

Please print clearly

Duration 3 hours

Attempt All SIX (6) questions.

Marks As indicated on each question in paper, 50 marks in total

Type of Exam Closed Book Exam – text, unit guide or reader not
permitted

Special Instructions • WRITE YOUR ANSWER IN THIS PAPER


• Simple Calculators permitted.

Do not commence reading or writing this


examination until you are told to do so.

Page 1 of 20
SECTION A – ANSWER ALL QUESTIONS
(All questions are worth 5 marks)

Question 1 (5 Marks)
This question has 10 parts. There are FIVE choices (A, B, C, D and E) associated with each
part. Put a circle around ONE of these letters to indicate your selection.

(i) Postal rates for letters are 50 cents up to 10 grams, 75 cents up to 50 grams
plus an extra 20 cents for each additional 25 grams up to 100 grams.

Which test inputs (in grams) would be selected using equivalence partitioning?

A. 8, 42, 83, 105


B. 5, 15, 65, 92, 158
C. 10, 50, 75, 100
D. 10, 49, 50, 51,100, 101
E. 5, 20, 40, 60, 80

(ii) Which is the following statement(s) could be used to assess coverage achieved
for white-box testing?

I. Decision outcomes exercised


II. Partition exercised
III. Boundaries exercised
IV. Statements exercised
V. Conditions exercised

A. I, II, III
B. II, III
C. I, IV, V
D. III
E. I, II, V

(iii) If test cases are derived from looking at the code, what type of test design
technique is being used?

A. Black box
B. White box
C. Specification-based
D. Behaviour-based
E. both A and C

(iv) Which of the following statements is NOT correct?

A. A minimal test set that achieves 100% path coverage will also achieve 100%
statement coverage.
B. A minimal test set that achieves 100% path coverage will generally detect more
faults than one that achieves 100% statement coverage.
Page 2 of 20
C. A minimal test set that achieves 100% statement coverage will generally detect
more faults than one that achieves 100% branch coverage.
D. A minimal test set that achieves 100% path coverage will generally detect more
faults than one that achieves 100% branch coverage.
E. A minimal test set that achieves 100% path coverage will generally detect more
faults than one that achieves 100% condition coverage.

(v) For the control graph shown below, three tests have been run:

1. Gold card holder who gets upgraded to business class.


2. Non-gold card holder who stays in economy.
3. A person who is bumped from the flight.

Assume each box in the control flow graph corresponds to a statement. What is the
statement coverage of these three tests?

A. 60%
B. 50%
C. 70%
D. 80%
E. 90%

vi) Which of the following is an accurate description of the relationship between a


fault and a failure?

A. A fault is caused by a failure


B. A fault is lead to a failure
C. A failure is caused by a fault
D. A failure must lead to a fault
E. A fault and a failure refers to the same concept.

vii) What is your understanding of the best testing technique?

A. Model-based testing.
B. Object-Oriented testing
C. No single testing technique

Page 3 of 20
D. Black –box testing
E. White-box testing

viii) Combinatorial testing is testing technique where the criteria used to design test
cases is that they

A. rely on basis path testing


B. exercise the logical conditions in a program module
C. select test paths based on the locations and uses of variables.
D. identify distinct attributes which can varied and systematically generate
combinations for testing
E. identify test paths based on the position of the class in the inheritance tree.

ix) Which of the following statement(s) describes concepts associated with


“Regression testing”?

I. Regression testing suffers from state space explosion.


II. Regression testing helps to ensure that any changes like bug fixes or any
enhancements to the module or application have not impacted the existing tested
code.
III. Regression test is required even when a very small change is done in the code
because this small modification can bring unexpected issues in the existing
functionality.
IV. Techniques used in this task for test case selection include test case prioritization
and test case minimization.
F. Maintaining models for software under test in regression testing is expensive.

A. I, V
B. I, II, III
C. I, IV, V
D. II, III, IV
E. I, II

x) GUI Testing has a number of characteristics which include:

I. Model-based testing and Capture and Replay of user sessions.


II. Automation is easy as many tools are available
III. Controlling GUI events is difficult.
IV. Cost of test maintenance is low.
V. Suffers from state explosion.

A. I, II, IV
B. II, IV
C. I, III, V
D. II, III
E. I, III

Page 4 of 20
Question 2 ( 8 Marks)

2) (i) Define what is a test case. Give actual examples to illustrate. (2 marks)

(ii) Describe, and give examples to illustrate, the difference between a test requirement
and a test case (1 mark)

(iii) Assume a predicate Q(y) that represents the statement:

• y is an odd number and a square number

State the truth values for the following:


(a) Q(121)
(b) Q(9)
(c) Q(21)
(d) Q(25)

(2 marks)

Page 5 of 20
Question 2 (Continued)

(iv) Given the Control Flow Graph (CFG) below, explain:

(a) What is a test path? Provide an example.


(b) What is a complete test path?
(c) What is a feasible path and what is an infeasible path. Provide examples using the
CFG provided.
(3marks)

Taken from: Foundations of Software Testing, A. P. Mathur, 2014

Page 6 of 20
ADDITIONAL PAGE FOR QUESTION 2

Page 7 of 20
Question 3 (10 Marks)

(a) Describe your understanding of data flow testing. Using an example, make sure that
you discuss: def-use; definition clear paths, simple paths, loop free path segments and
different data coverage criteria
(5 marks)

Page 8 of 20
Question 3 (Continued)

(b) Given the code below, (5 marks)

i. Draw the Control Flow Graph for the code segment given below.
ii. List all the def-use pairs for the code segment below.
iii. Give Provide a test suite for this code segment which will satisfy each of the
following test coverage criteria below (i.e. one for each criterion):

a) All-defs coverage
b) All-uses coverage
c) All-du-path coverage

1. input(X,Y)
2. while (Y>0) {
3. if (X>0)
4. Y := Y-X
else
5. input(X)
6. }
7. output(X,Y)

Page 9 of 20
ADDITIONAL PAGE FOR QUESTION 3

Page 10 of 20
Question 4 (9 Marks)

(i) Discuss how characteristics of object-oriented software will affect how we test such
software systems. Provide examples to demonstrate where appropriate. (3 Marks)

(ii) What is model-based testing? List models that can be used in testing and discuss the
advantages and disadvantages of model-based testing. (3 Marks)

Page 11 of 20
(iii) Describe your understanding of GUI testing; highlighting differences from non-GUI
based testing, difficulties and approaches that can be used in GUI testing (3Marks)

Page 12 of 20
Question 5 ( 9 Marks)

(a) Given the code above, with basic blocks marked and labeled (from A to I) above, (5
Marks)

(i) Draw the Control Flow Graph for the code segment.

Page 13 of 20
Question 5 (Continued)

(ii) List the set of basis path that will cover this CFG.

(iii) Derive your test cases using the basic path set from (ii).

(b) (4 marks)
(i) Outline your understanding of Junit, highlighting some of its key concepts that
you have used.

Page 14 of 20
Question 5 (Continued)

(ii) What is Selenium, how does it work? List its different software components.
Which types of tests can be done using Selenium?

Page 15 of 20
Question 6 ( 9 Marks)

(a) Given the following specification:

The software program accepts a 6 digit number and 3 real numbers (A, B, C) as
input. The 6 digit number is the student ID. (e.g. 111222). The 3 real numbers are
the marks for assessment items for a first year unit. The total mark for the unit is
obtained by adding the three marks. The range for A and B is 0 and 20 inclusive.
The range for C is 0 and 60 inclusive. The total mark is in the range of 0
(minimum) to 100 (maximum) marks. The program outputs the grade associated
with the total mark. If the total mark is <=50, the program outputs “F”, if the total
mark is >= 50, “P ” is the output.

(i) How many test cases is required for Strong Equivalence Class Testing?

(ii) How many test cases is required for Weak Equivalence Class Testing?

(iii) List the set of test cases for Weak Equivalence Class Testing?

(5 marks)

Page 16 of 20
Question 6 (Continued)

(b) Table 1 showed information associated with an internet-based software system.

Web Browser Operating System Connection Type


Firefox Windows LAN
Google Chrome Macintosh PPP
Opera Linux ISDN
Internet Explorer Unix PPPoE

Using the information in Table 1, develop a suite of test cases that will meet the
following coverage: (4 marks)

i. All combinations
ii. Each choice
iii. pair-wise
iv. Base Choice

END OF EXAMINATION PAPER

Page 17 of 20
ADDITIONAL PAGE FOR ANY QUESTIONS THAT YOU MAY NEED

Page 18 of 20
ADDITIONAL PAGE FOR ANY QUESTIONS THAT YOU MAY NEED

Page 19 of 20
DO NOT TURN THIS PAPER OVER UNTIL
INSTRUCTED TO DO SO

THIS IS THE EXAMINATION PAPER FOR

CSI3105 Software Testing

You are now under examination conditions:


The following are not permitted during this examination. Non-compliance may result in action
being taken under the University’s Academic Misconduct Rules (Students), which provide
penalties for misconduct in assessment.

• Possessing or controlling any unauthorised electronic device, including mobile


telephone, smart watch (all such devices must be turned off and placed in your bag).
• Possessing any unauthorised materials or sources of information viewable by you.
• Communicating or attempting to communicate in any manner with another student,
including sharing items e.g. calculator.
• View or attempt to view the work of another student or permit another student to view
or attempt to view your work.
• Accessing/attempting to access your bag or other items under your chair.
• If you have any questions, raise your hand and speak to an invigilator – do not stand up,
leave your desk or the room without permission.

Page 20 of 20

You might also like