Question details

Attempt this mock exam in preparation for the final examination.
$ 15.00

Curtin University — Department of Computing Software Engineering 110 (8933) Mock Exam A Practice for the final exam Real exam weight: 50% of the unit mark. An exam mark ≥ 50% is needed to pass the unit. Attempt this mock exam in preparation for the final examination. Answer all questions by yourself. Will the real exam be like this? The real exam will follow the same format and will cover the same material. However, the questions will be different (so trying to memorise answers will get you nowhere!) The real exam will also be closed book – no books, notes, electronic devices, etc. How can I get help/feedback? First, make your best attempt. Then, to obtain feedback, see your tutor, or the senior tutor, or the lecturer. Will you upload the answers? No. Sample answers to this mock exam will not be provided – no exceptions. Why? Sample answers discourage people from putting in real effort to learn the concepts and skills. They encourage rote (fake) learning, where you try to memorise an answer without understanding how to obtain it or even why it’s correct. Basically, if you’re given the answers, it’s too easy to convince yourself that you don’t need to work them out. Updated: 26/05/2014 Page 1 of 9 SE 110 Mock Exam A Question 1 (20 marks) State whether you (1) completely agree, (2) partially agree/disagree or (3) completely disagree with each of the following statements. Justify your answers. (a) “Software peer review finds maintenance issues, unlike testing which finds faults.” (b) “You can inspect any code or design document, but you cannot always test it.” (c) “Cohesion and coupling are both likely to be low in a poorly-written program.” (d) “High coupling will increase the chances that a fault in one module will have flow-on effects in other modules.” (e) “Test code does not need to be fault-free, because it is not part of the final product.” Question 2 appears on the next page Page 2 of 9 SE 110 Mock Exam A Question 2 (14 marks) For each of the following segments of Java code: • Describe each important maintainability issue (apart from the lack of comments). • Refactor the code to remove the issue(s), while keeping the functionality intact. Add or remove methods only if necessary. (a) boolean option; public void control() { int a, b, c, result; a = ConsoleInput.readInt(); b = ConsoleInput.readInt(); c = ConsoleInput.readInt(); option = a > b || b > c; result = calc(a, b, c); System.out.println(result); } public int calc(int x, int y, int z) { int result; if(option) result = x + y + z; else result = x * y * z; return result; } Question 2 continues on the next page Page 3 of 9 SE 110 Mock Exam A (b) double radius; public double areaOfCircle() { return Math.PI * radius * radius; } public double volumeOfCylinder(double length) { return length * Math.PI * radius * radius; } public double volumeOfCone(double height) { return 1.0/3.0 * height * Math.PI * radius * radius; } Question 3 appears on the next page Page 4 of 9 SE 110 Mock Exam A Question 3 (40 marks) You are helping to design the software for a broadcast system intended to notify people (predominantly in remote/regional areas) of imminent bush fire threats. (a) Consider the following description: As a bush fire emergency coordinator, I want an alert message to be issued via SMS, TV and radio to anyone in an area threatened by bush fires, to give them a chance to evacuate or stay and defend their homes. The alert message should contain advice on evacuation routes and the severity of the threat, to be entered by the coordinator, and weather details (temperature, wind speed and humidity) to be obtained automatically. This will require the system to communicate with a few other systems: • A weather monitoring system, able to retrieve real-time weather information on any specific region. • A radio/TV broadcast system, able to suspend normal broadcasting on all channels and substitute an emergency message instead. • Mobile phone networks, able to send an emergency SMS to everyone in a specific region. (For simplicity, assume that there are a fixed number of “regions” throughout the country, each uniquely identified by a name.) Develop a use case for this description, and include at least two extensions. Also include all other information emphasised in the lectures and practicals. State any reasonable assumptions you make about the system requirements. Question 3 continues on the next page Page 5 of 9 SE 110 Mock Exam A (b) For each of the characteristics listed below: • Give a plausible, valid NFR relating to the fire emergency system described above. • Briefly explain what makes it valid. • Explain how it could be tested. (i) Performance. (ii) Reliability. (iii) Usability. (iv) Precision. (Don’t be scared of this one. Use your imagination!) Question 3 continues on the next page Page 6 of 9 SE 110 Mock Exam A (c) Moving from requirements to design: (i) What container classes would you suggest for this system? (ii) What boundary classes would you develop? (iii) Pick three of your classes (boundary and container) and write CRC cards for them. Question 4 appears on the next page Page 7 of 9 SE 110 Mock Exam A Question 4 (26 marks) The following submodule (a static method inside TimeManager) imports an “event” and adds it to a calendar as either a “work” or a “personal” event, depending on the time it occurs. Submodule addEvent Imports: inEvent (Event), inCalendar (Calendar) Exports: nothing Algorithm: date = inEvent.getDate time = inEvent.getTime duration = inEvent.getDuration IF duration >= 0 THEN IF date.isWeekDay AND time.inBusinessHours THEN inCalendar.addWorkEvent <-- date, time, duration ELSE inCalendar.addPersonalEvent <- date, time, duration ENDIF ENDIF The addEvent submodule uses a few other classes: • Event contains a date, time and duration, accessed with the methods getDate, getTime and getDuration. The date and time are themselves objects. The duration is an integer, in minutes. • Calendar represents the user’s calendar, including all event details. It has (at least) these two methods: addWorkEvent and addPersonalEvent. Both import a date, time and duration. • Date contains the method isWeekDay, which returns true if the date is a day from Monday to Friday, or false otherwise. • Time contains the method inBusinessHours, which returns true if the object represents a time from 9am to 5pm, or false otherwise. (a) Using a white-box approach, design a complete set of test cases for the addEvent submodule. (i) Identify all the different conditions that must be tested. (ii) Identify the objects that should be mocked. (iii) Identify the submodules called by addEvent that should be stubbed. (iv) Identify the submodules called by addEvent that should be verified. (b) Implement your test cases in Java. You may omit any Java import statements. You may use JUnit if you wish. Page 8 of 9 SE 110 Mock Exam A End of Mock Exam A Page 9 of 9

Available solutions