Software Measurement and Quality Assurance Congestive Cardiac Failure

FIND A SOLUTION AT Academic Writers Bay

CO3095/7095/7508
All candidates
Semester 1 Examinations
DO NOT OPEN THE QUESTION PAPER UNTIL INSTRUCTED TO DO SO BY
THE CHIEF INVIGILATOR
School
Informatics
Module Code
CO3095/7095/7508
Module Title
Software Measurement and Quality Assurance
Exam Duration
24 hours
CHECK YOU HAVE THE CORRECT QUESTION PAPER
Number of Pages
5
Number of Questions
4
Instructions to Candidates
Answer all questions.
All marks gained will be counted.
FOR THIS EXAM YOU ARE ALLOWED TO USE THE FOLLOWING:
Calculators
Yes
Books/Statutes provided by
the University
Yes
Are students permitted to
bring their own
Books/Statutes/Notes?
Yes
Additional Stationery
Yes
Version 1 Page 1 of 5
CO3095/7095/7508
All candidates
1. Briefly (up to 100 words per item) explain…
(a) The difference between subjective and objective quality in the context of software
development. Use an example.
[5 marks]
(b) Three key differences between the waterfall model and agile methodologies for soft
ware development.
[5 marks]
(c) The meaning of Dijkstra’s quote “Testing can show the presence of errors, but not
their absence” in the context of software quality assurance.
[5 marks]
(d) The difference between statement coverage, branch coverage, and condition/decision
coverage. Use an example different from the ones provided in the lecture materials
[5 marks]
(e) The main benefits of carrying out code reviews. [5 marks]
Version 1 Page 2 of 5
CO3095/7095/7508
All candidates
2. Given the following drive method, write a set of test cases that will satisfy MC/DC. Justify
your answer by showing the procedure you have followed to come up with these test cases.
Enumerate your tests cases, and for each of them, produce a concrete call to drive and
indicate the expected outcome, e.g.:
Test Case #
Call
Expected Outcome
1
drive(*, *, 0, 0.1, 3, false)
Sounds alarm and then stalls
2


3





Note: In the call, * means the value of the argument is not important for the test case.
1 private static void drive(double accelerator, boolean brake,
2 double clutch, double fuel,
3 int gear, boolean seatbelt)
[15 marks]
Version 1 Page 3 of 5
CO3095/7095/7508
All candidates
3. The Java program lcm below takes two integer parameters n1, and n2 and calculates the
Least Common Multiplier (LCM) for these two numbers. For example:
• LCM of 12 and 30 = 2 * 2 * 3 * 5 = 60
• LCM of 12 and 18 = 2 * 2 * 3 * 3 = 36
• LCM of 18 and 15 = 2 * 3 * 3 * 5 = 90
• LCM of zero and any other number = undefined (exception)
1 public static long lcm(long n1, long n2) n2 == 0)
3 throw new IllegalArgumentException(“arguments must be positive”);
4 long result;
5 long i = 2;
6 if (n1 > n2)
7 result = n1;
8 else
9 result = n2;
10 long temp = result;
11 while (result % n1 != 0
(a) Draw the control flow graph for the lcm method and compute its cyclomatic complexity. [10 marks]
(b) Construct a minimal set of test cases that achieves 100% Statement coverage and
100% Branch coverage. Use the following table to present your test cases, indicating
the input values, expected output, and lines of code covered by each test case (e.g.,
“1,4-6,10-15”). You are not required to write JUnit code. [10 marks]
Test Case #
Input n1
Input n2
Expected Output
Lines Covered
1




2




3









(c) Write a set of test cases that achieves the highest possible Condition Coverage for
the lcm method. Use the test cases from your previous answer as a starting point
(that is, copy the table you constructed in the previous answer and add rows to the
new copy). Indicate how each new test contributes towards increasing Condition
Coverage, using the following formula to justify your answer:
Condition Coverage =
jTruth values taken by all basic conditionsj
2 ∗ jBasic conditionsj [10 marks]
Version 1 Page 4 of 5
CO3095/7095/7508
All candidates
4. (a) Data-flow Testing: For all the variables contained in the lcm method, list all the
definition-use pairs, and indicating whether they correspond to predicate (p-use) or
computational uses (c-use). You can use the following table as template.
Variable Def-use pairs (p-use) Def-use pairs (c-use)
n1 (1,2), … (2,3), …
n2 (3,4), … (5,6), …
… … …
[10 marks]
(b) Symbolic Execution: Draw the symbolic execution tree for the lcm function, covering
only one traversal of the while-loop body. Use the format below, where terminating
paths are indicated with grayed nodes and non-terminating paths are indicated with
dashed nodes. [10 marks]
n1=N1, n2=N2
PC: true

PC: …

PC:…
terminating path 1

PC: …

PC: …
terminating path 2

PC: …

PC: …
non-terminating path

PC: …
terminating path 3
true false
true false
true false
(c) Mutation Testing: For each of the following three mutants for the lcm method, write
a test assertion which would pass in the original code of lcm but would fail on the
mutant. If such an assertion cannot be constructed for either of the mutants, justify
why (up to 100 words). Use these templates for your assertions:
assertEquals(expected, lcm(a, b)); // for normal behaviour
assertThrows(Exception.class, () -> lcm(a, b);); //for exceptional behaviour.
[10 marks]
Mutant 1: Replace n2 == 0 with false in line number 2, i.e.:
2

+
if (n1 == 0 || n2 == 0)
if (n1 == 0 || false)
Mutant 2: Replace > with <= in line number 6, i.e.:
6

+
if (n1 > n2)
if (n1 <= n2)
Mutant 3: Replace || with && in line number 11, i.e.:
11
– while (result % n1 != 0 || result % n2 != 0) {
+ while (result % n1 != 0 && result % n2 != 0) {
Version 1 END OF PAPER Page 5 of 5

YOU MAY ALSO READ ...  59008 – Assignment CoversheetName: ______________________ Student
Order from Academic Writers Bay
Best Custom Essay Writing Services

QUALITY: 100% ORIGINAL PAPERNO PLAGIARISM – CUSTOM PAPER