Software Measurement and Quality Assurance | My Assignment Tutor

CO3095/7095/7508All candidates Semester 1 Examinations DO NOT OPEN THE QUESTION PAPER UNTIL INSTRUCTED TO DO SO BYTHE CHIEF INVIGILATORSchoolInformaticsModule CodeCO3095/7095/7508Module TitleSoftware Measurement and Quality AssuranceExam Duration24 hoursCHECK YOU HAVE THE CORRECT QUESTION PAPERNumber of Pages5Number of Questions4Instructions to CandidatesAnswer all questions.All marks gained will be counted.FOR THIS EXAM YOU ARE ALLOWED TO USE THE FOLLOWING:CalculatorsYesBooks/Statutes provided bythe UniversityYesAre students permitted tobring their ownBooks/Statutes/Notes?YesAdditional StationeryYes Version 1 Page 1 of 5 CO3095/7095/7508All 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 software development.[5 marks](c) The meaning of Dijkstra’s quote “Testing can show the presence of errors, but nottheir absence” in the context of software quality assurance.[5 marks] (d) The difference between statement coverage, branch coverage, and condition/decisioncoverage. 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/7508All candidates 2. Given the following drive method, write a set of test cases that will satisfy MC/DC. Justifyyour 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 andindicate the expected outcome, e.g.: Test Case #CallExpected Outcome 1drive(*, *, 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) {4 resetAlarm();5 if (fuel < 0.3 || !seatbelt)6 soundAlarm();7 if (clutch < 0.2 && gear != 0) {8 stall();9 } else {10 if (accelerator > 0 && !brake && clutch >= 0.2 && seatbelt) {11 if (gear > 0)12 accelerate(accelerator);13 else if (gear < 0)14 reverse(accelerator);15 else16 revUp(accelerator);17 }18 }19 }[15 marks]Version 1 Page 3 of 5 CO3095/7095/7508All candidates 3. The Java program lcm below takes two integer parameters n1, and n2 and calculates theLeast 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) {2 if (n1 == 0 || 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 else9 result = n2;10 long temp = result;11 while (result % n1 != 0 || result % n2 != 0) {12 result = temp * i;13 i++;14 }15 return result;16 }(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 and100% Branch coverage. Use the following table to present your test cases, indicatingthe 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 n1Input n2Expected OutputLines Covered 1………… 2………… 3………… …………… (c) Write a set of test cases that achieves the highest possible Condition Coverage forthe 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 thenew copy). Indicate how each new test contributes towards increasing ConditionCoverage, using the following formula to justify your answer:Condition Coverage =jTruth values taken by all basic conditionsj2 ∗ jBasic conditionsj [10 marks]Version 1 Page 4 of 5 CO3095/7095/7508All candidates 4. (a) Data-flow Testing: For all the variables contained in the lcm method, list all thedefinition-use pairs, and indicating whether they correspond to predicate (p-use) orcomputational 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, coveringonly one traversal of the while-loop body. Use the format below, where terminatingpaths are indicated with grayed nodes and non-terminating paths are indicated withdashed nodes. [10 marks] n1=N1, n2=N2PC: true …PC: …… PC:…terminating path 1 …PC: ……PC: …terminating path 2…PC: ……PC: …non-terminating path…PC: …terminating path 3true falsetrue falsetrue false(c) Mutation Testing: For each of the following three mutants for the lcm method, writea test assertion which would pass in the original code of lcm but would fail on themutant. If such an assertion cannot be constructed for either of the mutants, justifywhy (up to 100 words). Use these templates for your assertions:assertEquals(expected, lcm(a, b)); // for normal behaviourassertThrows(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 n2)if (n1

QUALITY: 100% ORIGINAL PAPER – NO PLAGIARISM – CUSTOM PAPER

Leave a Reply

Your email address will not be published. Required fields are marked *