Premium Resources

We know the secret of your success

M256/F Software development with Java Undergraduate Level Course Examination 2012

$39.00

PAPER TITLE: SOFTWARE DEVELOPMENT WITH JAVA

DATE: Friday, 12 October 2012

 

PART 1

 

Question 1         Which two of the following statements about object-oriented software are true? (Select two options)

A.    Javadoc is an example of a design tool.

B.    Maintenance can involve adding extra functionality to the system.

C.    A link in an object diagram illustrates the connection between an object and its corresponding real-world entity.

D.    Developing a dynamic model typically involves decisions such as which existing classes can be reused and what programming constructs are appropriate.

E.    An object diagram does not imply anything about how links between objects are implemented.

 

ANSWERS(Purchase full paper to get all the solution)
C.    A link in an object diagram illustrates the connection between an object and its corresponding real-world entity.
D.    Developing a dynamic model typically involves decisions such as which existing classes can be reused and what programming constructs are appropriate.

 

Question 2          Based on the information above which two of the following statements are true? (Select two options)

A. The diagram is a static model

B. The diagram shows that there is a collaboration between team6 and fixture2

C. The diagram shows how the objects in it interact.

D. The diagram shows that “Panthers“ is an attribute of team3 .

E. The diagram shows that fixture2 has attributes date, homepoints and awayPoints

 

Question 3         Which two of the following statements relating to the requirements specification process are true? (Select two options)

  1. The following is an example of a constraint that is not a behavioural requirement:

‘Patients listed in the Discharged Patients report should be arranged in alphabetical order of their names.’

  1. The following is an example of a behavioural requirement:

‘The Discharged Patients report should be printed on a separate page for each ward in the hospital.’

  1. The requirements document should not include details of the budget.
  2. The requirements elicitation and requirements analysis phase are intertwined, with each informing the other through a process of feedback and iteration between the analyst and stakeholders.
  3. The following is an example of an acceptance test:

‘The software should allow the patient’s move to another ward to be recorded.’

  1. In the elicitation process the analyst should ignore a client’s description

of constraints on the system that are not linked to behavioural requirements as these are factors that should be considered in the design phase of development.

 

 

Question 4         Which two of the following statements about conceptual modelling are true? (Select two options)

  1. A multiplicity specifies how many links of an association there can be.
  2. If there is an association between two classes P and Q, then at any given time there must be an instance of P which is linked to at least one instance of Q.
  3. In M256, if an event involves more than two significant entities in the system and has properties that need to be recorded, it is sensible for the conceptual model to include a class whose instances will model that type of event.
  4. In the Hospital System, the condition

A Team object is linked to exactly one ConsultantDoctor object

is not considered to be an invariant because the class diagram records the fact by having a multiplicity of 1 at the ConsultantDoctor end of isHeadedBy.

  1. A condition stating the maximum number of patients that can be on any ward would give rise to an invariant in the Hospital System.

 

Question 5         Which two of the following statements about conceptual modelling are true? (Select two options)

 

  1.     An invariant is always required when a number of associations in a class diagram form a loop.
  2.     An organisational unit in the system domain may be appropriately modelled by an object.
  3.     If a class has a derived attribute then there must be an invariant that provides the derivation of the attribute.
  4.     If a number of associations in a class diagram form a loop, and there is an invariant involving links of all the associations in the loop then it must be possible to derive one of the associations which make up the loop from the others.
  5.     A recursive association is one where an object of one class may be linked to more than one object of another class.

 

 

Question 6         Based on the information in Figure 2 above, which two of the following statements are true? (Select two options)

  1. If a Waiter object aWaiter and a Reservation object aReservation are linked, then aWaiter must be linked to the Table object that is linked to aReservation.
  2. If a Waiter object aWaiter and a Table object aTable are linked, then aTable must be linked to a Reservation object that is linked to aWaiter.
  3. The multiplicity of the forA association at the Table end should be

0..*.

  1. The multiplicity of the takes association at the Reservation end should be 0..*.
  2. The class Manager generalises the class Staff.
  3. The class Staff should be marked <> in the class diagram.

 

Question 7         Which three of the following statements are true? (Select three options)

  1.  A method’s pre-condition should state what invoking the method achieves.
  2.  The default, in the absence of an explicit modifier in front of a class member, is that the member cannot be accessed from outside the class’s package.
  3.  Assigning private accessibility to all instance variables is all that is required to prevent privacy leaks.
  4.  When a class P, is reused by composition by another class Q, this is achieved by each instance of Q having an instance (or instances) of P as part of its state.
  5.   Coupling is a measure of how strongly related and focused the responsibilities of a component are.
  6. Encapsulation and polymorphism both contribute to the possibility of using a class in different systems.

 

 

Question 8         Which one of the following statements is a correct identification of the missing text indicated by the labels X, Y and Z in the sequence diagram? (Select one option)

A. X is RestaurantCoord; Y is (reservation2, customer4); Z is table6

B. X is RestaurantCoord; Y is customer4; Z is table6

C. X is restaurant; Y is (reservation2, customer4); Z is table6

D. X is restaurant; Y is customer4; Z is table6

E. X is restaurant; Y is customer4; Z is (table6, 31/12/12)

 

 

Question 9         On the basis of the information provided in Figure 3 and 4, which two of the following statements are true? (Select two options)

 

  1. It is possible to create a sequence diagram that shows different collaborations from those in Figure 4, but which still corresponds to the given walk-through.
  2. Figure 4 shows step 2 of the walk-through being carried out by reservation2.
  3. Figure 4 shows step 4 of the walk-through being carried out by restaurant.
  4. Figure 4 shows step 3 of the walk-through being carried out three times.
  5. Figure 4 indicates that reservation1 is not linked to any Table object.

 

 

Question 10       On the basis of information provided in Figure 3 and 4, which two of the following statements are true? (Select two options)

  1.             A method whose specification begins as follows is appropriate for the protocol of Reservation:

Customer getCustomer()

B.                A method whose specification begins as follows is appropriate for the protocol of RestaurantCoord:

                Table getTable()

C.                A method whose specification begins as follows is appropriate for the protocol of RestaurantCoord:

Map getTablesAndCustomers(M256Date aDate)

D.            A method whose specification begins as follows is appropriate for the protocol of RestaurantCoord:
Map getTablesAndCustomers(M256Date aDate)

E.            A method whose specification begins as follows is appropriate for the protocol of Table:

Table getTable()
 

 

Question 11       Which two of the following statements about designing software are true? (Select two options)

  1.     An advantage of a design based on forking is that it is more likely to result in lower coupling than a design based on cascading.
  2.     If there is no direct association between two classes then there is no coupling between them.
  3.     An invalid scenario is one for which a pre-condition is not met.
  4.     If the coordinating class does too much work then the cohesion of other core system classes may be reduced.
  5.     An object which initiates a cascade of messages is termed an information expert.

 

 

Question 12       Which two of the following statements about detailed design and implementation are true? (Select two options)

  1.     Choosing the most general type with the required protocol as the type of an instance variable increases the maintainability of the resulting software.
  2.     A utility class is a helper class that is only intended to be used within the particular system under development.
  3.     The term composition relates to the insertion of multiple objects into a single collection object.
  4.     One aspect of detailed design is extending the system’s behaviour by refactoring the structure of the system.
  5.     An enumerated type can be used to implement an attribute which has a fixed number of possible values.

 

 

Question 13       Which two of the following statements relating to design and Java implementation are true? (Select two options)

  1.     A toString() method should only be specified for classes that override the equals() method.
  2.     If an instance variable references an immutable object it is not possible to change the value of that instance variable.
  3.     An immutable class is one whose instances cannot be modified.
  4.     Any object that is used as the argument to a compareTo() method is termed a hashcode.
  5.     A compareTo() method should be specified for each class whose objects have a natural ordering that is to be used when storing them in sorted collections.

 

 

Question 14       Which two of the following statements about implementation and testing are true? (Select two options)

  1.     Acceptance testing is a form of verification.
  2.     Unit testing is a form of validation.
  3.     Regression testing is carried out not only while the system is being developed but also when the system is operational.
  4.     A use-case driven approach to implementation minimises the need for integration testing.
  5.     Testing should include checking that the code does not do anything extra that it is not supposed to do.

 

 

Question 15       Which two of the following statements about the M256 approach to implementing software in Java are true? (Recall that in M256 the first code iteration is the first stage in implementing a core system.) (Select two options)

  1.     Derived attributes should never be implemented in the first code iteration.  
  2.     A toString() method for each class is normally implemented in the first code iteration.
  3.     The coordinating method for each use case is normally implemented in the first code iteration.
  4.     In the use-case driven approach to implementation, the sequence diagrams for each use case indicate what methods need to be implemented and how the methods are related.
  5.     Instance variables representing link references should not be implemented in the first code iteration.

 

 

Question 16       Which two of the following statements about user interfaces and their design are true? (Select two options)

  1.     Affordance, when referring to a widget in a user interface, is the extent to which the widget's purpose is apparent to the user.
  2.     Interface metaphors make use of a user’s pre-existing knowledge to aid usability of a system.
  3.     In the context of GUI design and evaluation, the term visibility means the extent to which a widget is conspicuous within an interface.
  4.     A user interface metaphor should typically be independent of users’ mental models.
  5.     With direct manipulation, complex outcomes can typically be achieved by a number of simple incremental and reversible steps.

 

 

Question 17       Which two of the following statements about user interfaces and their design are true? (Select two options)

  1.     The Xerox Star system was an early example of the connection between object-oriented technology and graphical user interfaces.
  2.     A user interface should be considered in isolation from the tasks to be performed.
  3.     In the context of user interfaces, effectiveness is often measured in terms of the time taken to complete a task.
  4.     Think-aloud is an example of a usability testing technique.
  5.     All graphical user interfaces use direct manipulation.

 

 

Question 18       Which two of the following statements about building a graphical user interface (GUI) are true? (Select two options)

 

  1.     Acceptance tests should test the usability of the GUI as well as the functioning of the whole system.
  2.     Java’s Swing components have characteristics that are typical of reusable components.
  3.     Acceptance testing is normally carried out on an on-going basis during the development of the GUI.
  4.     The core system must always contain a reference to any GUI that uses it.
  5.     It is the GUI implementer’s responsibility to determine what data is required to initialise each component of the user interface.

 

 

Question 19       Which two of the following statements are true? (Select two options)

  1.     A logical architecture is a view of a system in terms of how components are connected and how they work together.
  2.     In large systems, package diagrams can be very useful for keeping track of dependencies between different system components.
  3.     The concept of coupling can help you decide where to locate responsibilities for managing concurrent access.
  4.     The Publish-Subscribe pattern is a creational design pattern that describes a design in which a new instance of a class is created only if an instance of the class does not already exist.
  5.     Object serialisation is the only way of facilitating persistence.

 

 

Question 20       Which two of the following statements are true? (Select two options)    

  1.     One advantage of tiered architecture is that reuse is made simpler.
  2.     The term computer architecture is normally used to refer to how different computers involved in a system are connected.
  3.     The waterfall method typically produces a series of prototypes giving the client opportunities to ‘see’ what is being developed throughout the process.
  4.     The Rational Unified Process (RUP) is an example of a waterfall approach to developing software.
  5.     Timeboxing is a key element of rapid application development (RAD).

 

 

 

 

PART 2

This part contains four questions, each worth 20 marks. You should attempt three of these questions.

 

Question 21      (20 marks) 

The following is an extract from a requirements document for a system to help manage a company which operates a group of children’s zoos.

System domain

The company oversees the running of several children’s zoos, each with a different name. Each zoo exhibits at least 50 animals with no upper limit on the number exhibited. Animals are not moved from zoo to zoo. Both pets (tortoises, rabbits, etc.) and wild animals (owls, badgers, etc.) are exhibited in each zoo. Each animal has a name which is unique throughout the company.

A family may adopt one or more animals, which means that they make a regular contribution towards the feeding of those animals. An animal may be adopted by at most four families at any one time. The system only keeps records of families that currently adopt animals and details of current adoptions. It does not keep records of previous adoptions nor of families that currently are not adopting any animal.

From time to time each zoo plans special events, to each of which are invited up to 15 of the families which adopt animals at that zoo. No more than three special events may be planned by a zoo at a time. Each special event is held at the zoo on a specific date and has a limit (less than 16) on the number of families which may be invited to it. This system only needs to deal with future planned special events; no record is kept of such events in the past.

In addition to being invited to special events, a family may, if it is adopting a pet, visit that animal in its enclosure with a guide on one occasion only. A family may make any number of further unguided visits to a pet it has adopted but no record is kept of these unguided visits.

Use cases

List Animals. The administrator identifies a zoo. The system displays the name of each animal at that zoo together with its species (rabbit, owl, etc.) and, if the animal is a wild animal, a description of its natural habitat, e.g. ‘Marshland’.

Visit Animal. The administrator identifies an adopting family, and a pet that the family has adopted. The family should not already have visited the animal with a guide. The system records that the family has visited the animal.

List Zoo and Adopting Families. The administrator identifies an animal. The system displays the name of the zoo where the animal is exhibited. It also displays (if the animal has been adopted) the names and addresses of the families which have adopted the animal with the dates on which the adoptions began and the amounts per week that the adoptions cost.

Invite Family. The administrator identifies a special event and a family that adopts an animal at the zoo holding the event. If the event’s limit has already been reached the system informs the administrator of this fact. Otherwise, the system records that the family is invited to the event.

  1. Explain why it is not necessary to use a class to model the event of a family visiting an adopted pet with a guide. (2 marks)



    Note that in the remaining parts of this question you are dealing with a conceptual model. You will lose marks for including in your answers anything that is not relevant for a conceptual model.

    Figure 5 is an incomplete class diagram for a conceptual model with four classes unnamed and all the associations omitted.

     
  2. Copy this incomplete class diagram into your answer book. Identify the four missing classes and put appropriate names for them into the four blank rectangles in your diagram. (2 marks)
  3. (i) Now complete the class diagram for a conceptual model that you began in (b). (8 marks))(ii) Write the class descriptions required for a conceptual model for the system. This should involve the classes in Figure 5 above, along with the classes identified in your solution to part (b), and no other classes. You should omit all comments.
  4. State an invariant that should be included in your conceptual model to express the constraint that a family that visits a pet with a guide must have adopted that pet. (2 marks)
  5. State in real-world terms a constraint that is stated in the requirements document and requires to be modelled by adding an invariant different to that in (d) to your conceptual model. The constraint should not be related to the uniqueness of attribute values. There may be several such constraints; only one is required. (1 mark)

 

 

Question 22   (20 marks)

The following unfinished class diagram is a part of a structural model being developed for a dental surgery’s appointment booking system.

The following is a description of one of the use cases for this system.

Cancel Appointment

The receptionist identifies a patient and provides a date. The patient must have an appointment for that date. The system records the cancellation of the appointment. The number of cancellations made by the patient is incremented by 1. The cancelled appointment and all information about it is removed from the system.

The object diagram below shows the relevant objects and links for a particular scenario of the use case, before the use case is initiated. In particular it shows all the Appointment objects linked to patient4.

  1. Draw an object diagram showing the relevant objects and links after the use case has completed, with the identified object being patient4 and the date provided being 01/02/13.

 

(2 marks)

  1. It can be deduced from the use case description that the coordinating method requires a pre-condition. Write out part of a formal specification for the coordinating method, as follows. You should use cancel for the name of the method and you should give the method header (i.e. the return type, method name and any argument(s) and their type(s)) and the pre-condition. You are not required to give the post-condition.

 

(3 marks)

  1. Consider the following incomplete walk-through for the scenario above for cancelling an appointment where the identified Patient object is patient4 and the date provided is 01/02/13.

  1. Identify any navigations that are required for steps 1 to 3. For each navigation that you identify, write down the name of the association and the direction in which it needs to be navigated.
  2. Now complete the above walk-through. Write down the remaining steps as your answer in the answer booklet.

(4 marks)

  1. Complete the following sequence diagram for the above scenario, based on the walk-through above. Note that surgery is the coordinating object.
    You should use a cascade design for the messages required for the removal of the relevant links. Annotate the diagram with numbers to indicate where each walk-through step is achieved.
    Give the complete sequence diagram in your answer book.
  2. Now consider the following scenario for the same use case. The object diagram below shows all the Appointment objects linked to patient5 and represents the situation before the use case is initiated.

 

 

Question 23 (20 marks)

Consider the following class diagram and class descriptions extracted from an implementation model for a faculty library’s loan system. Then answer the parts (a) and (b) which follow. You are advised to read the questions first and then refer to the extract from the implementation model in order to answer them. Note that this question contains four parts in all. The last two parts are based on dynamic models which are given later.

The following class diagram and class descriptions are part of an implementation model for the Library System, a system for a library in a faculty with departments of Mathematics, Computing and Technology. The library has books that are categorised as either Maths, Computing or Technology. Members of the library can have up to 6 books on loan at any one time.

Note that for the purposes of this question many attributes have been omitted, such as author for the class Book and IDNumber for the class Member.

The system employs the class Name as specified on pages 14 and 15 of the M256 Handbook. It also employs a user-defined type, Category.

 

 

  1. The instance variable category in class Book should be restricted to taking values representing the categories MATHS, COMPUTING and TECHNOLOGY only. Specify a suitable type, Category, for this instance variable.

(3 marks)

The following table sets out a test case specification for a test of the method hasOnLoan(aCategory) in the class Member.

Read the following notes and then write a JUnit test method test1HasOnLoan() corresponding to the test case specified in Table 1.

Notes:

  • Your answer should consist of the complete test method including the header.
  • You should assume that (except for the method being tested and the coordinating method hasOnLoan(aMember, aCategory)) all methods specified in the given extract from the implementation model have already been implemented and tested.
  • You can use any valid values for attributes that are not specified in Table 1.
  • You are not required to provide Javadoc or any other comments.

(9 marks)

 

  1. Suggest a suitable order for implementing the methods required for the design of the use case

List a Member's Books on Loan for a Category

You should not include methods that would be implemented in the first code iteration and should only include methods that are specified in the class descriptions. Do not include additional methods that might be needed for testing. For each method give its class and its name.

(3 marks)

  1. Write the code, including the method header, for the method hasOnLoan()of the class Member, based on the above dynamic models. You are not required to provide Javadoc comments.

(5 marks)

 

 

 

Question 24 (20 marks)

  (a) This part of the question is about improving an initial prototype graphical user interface (GUI) design for a central heating controller application to run on a desktop computer as part of a home automation system. Read the descriptions below, then answer the questions that follow.

The design is comprised of two screens, as shown below.

The first screen

The first screen allows a user to choose to edit the settings either for central heating or for hot water. For each of these options, the user can choose to edit the settings either for weekdays or weekends.

From the first screen the user can navigate via a button (Set) to the second screen.

The second screen

The second screen is for setting central heating or hot water times, depending on the choice made on the first screen.

This screen uses labels ‘1 2 3 4 5’ to represent weekdays and ‘6 7’ to represent the weekend, so the first row of times displayed relates to weekdays and the second to weekends. For each of the weekdays, and for the weekend, four corresponding times are displayed: two times when the central heating/hot water comes on, and two times when it goes off. (Individual days of the week all have the same ‘weekday’ settings.)

Although the second screen shows two rows of times, only one of them can be edited, according to the choice made on the first screen between weekday and weekend. So, two on-times and two off- times can be set, one by one, by selecting the time using the appropriate radio button, and incrementing and decrementing the time displayed using the + and buttons.

Clicking on the Back button returns the user to the first screen.

  1. The design heuristic Prevent errors can be applied to improve the design of the first screen in respect of the set of four check boxes. Decide on an appropriate improvement, giving your answer in the form of a design rationale. (2 marks)
  2. Use the design heuristic Speak the users’ language to identify a fault with the second screen and a consequent improvement that can be made to it. Give your answer in the form of a design rationale. (2 marks)
  3. Explain the difference between a design principle and a design heuristic. (2 marks)

 

  1. This part of the question is about a Java GUI for a hospital administration system. Read the description below then answer the questions that follow.

The Change Ward screen allows the user to initiate the Change a Patient’s Ward use case. Here is a description of this use case.

Change a Patient’s Ward

The administrator identifies a patient and a ward, both known to the system.

The ward must be different from the ward that the patient is currently on. The ward must be of type male if the patient is male and of type female if the patient is female. The ward must have at least one free bed.

The system records that the patient is no longer on the original ward and is now on the new ward.

Imagine that a user interface designer has worked on the Change a Patient’s Ward use case and has decided that the user will select from a scrollable list of the names of all the patients in the hospital. When the user makes this selection a text field will display the name of the ward the patient is currently on. A second scrollable list will display the names of all the available wards i.e. all the other wards of the same type (male or female) that have at least one free bed. When the Change Ward screen is first displayed the first name in the list of patient names is selected by default, the text field displays the name of that patient’s ward and the list of ward names displays the names of wards of the correct type for the patient that the patient is not currently on and with at least one free bed.

The user selects a new ward from the second list for the selected patient and clicks the Change ward button. The change of ward is recorded and the details are confirmed by a message in a text area.

This is illustrated by the design sketch in Figure 13.

When this design is implemented the GUI will communicate with the core system implemented in the package hospitalcore which includes a coordinating class HospCoord and several other core classes including Patient and Ward.

Below are extracts from the Javadoc for some methods of the core system classes, some, but not all of which are required for building the Change Ward screen.

 

 

Below are some notes on the GUI that you will need to answer parts (i) and (ii).

  • The coordinating object is referenced by the instance variable hospital of type HospCoord.
  • the first scrollable list (labelled Select a patient) is referenced by a variable patientList of type M256JList;
  • the first list is populated with Patient objects;
  • the second scrollable list (labelled Select a new ward) is referenced by a variable wardList of type M256JList;
  • the text field (labelled Selected patient’s ward) is referenced by a variable wardField of type JTextField;
  • The outcome text area is referenced by a variable messageArea of type JTextArea
    i. Write code for the body of a method displayWardChange() for the GUI class which handles the selection of an item from the scrollable list of patient names. The method should display in the text field the name of the ward that the patient with the selected name is currently on. It should display in the second scrollable list the names of available wards. These are all the wards in the hospital except: the ward the patient is currently on; wards whose type is different to the sex of the patient; and wards with no free beds. The first item in the second scrollable list should be selected by default.
    You should note the following:
    when the second list is populated with a collection of Ward objects, the ward name corresponding to each Ward object will automatically be displayed in this list.(10 marks)

    ii. Write code for the body of a handler method for the Change ward button: recordWardChange(). The method calls on the core system to record that the selected Patient object is no longer linked to its previous Ward object and is now linked to a different Ward object that has been selected. A message is displayed in the outcome text area in the form of this example: “Patient Mr John Smith moved to Grange Spinney ward.” The text field displays the name of the new ward and the list of wards is updated to show the wards that are now available for the currently selected patient to move to. (4 marks).

 

 

 

[END OF QUESTION PAPER]

 

Purchase full paper by adding to cart

 

Last updated: Sep 02, 2021 12:26 PM

Can't find a resource? Get in touch

AcademicianHelp

Your one-stop website for academic resources, tutoring, writing, editing, study abroad application, cv writing & proofreading needs.

Get Quote
TOP