Premium Resources

We know the secret of your success

M256/C Software development with Java Undergraduate Level Course Examination 2017

$39.00

PAPER TITLE: SOFTWARE DEVELOPMENT WITH JAVA

DATE: Tuesday, 12 September 2017

 

PART 1

 

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

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

B. The Waterfall method is an example of an adaptive software development method.

C.  UML is useful for producing diagrams at an appropriate level of abstraction.

D.  An initial structural model of a system is a static model that illustrates the state of the system at a particular time.

E.  Enhancing the system by adding extra facilities is part of the maintenance phase.

 

ANSWERS(Purchase full paper to get all the solution)

C.   UML is useful for producing diagrams at an appropriate level of abstraction.

E.   Enhancing the system by adding extra facilities is part of the maintenance phase.

 

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

A.    isAwayTeam is the association which illustrates the relationship between team7 and fixture2.
B.    The diagram shows the state of part of the system at a particular point in time.
C.    The diagram shows that the state of  fixture2  is  date, homeScore and awayScore.
D.    The diagram shows a collaboration between team6 and fixture2.
E.    The diagram shows that name is an attribute of team7.
 

 

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 behavioural requirement: All hospital reports must be in PDF format
  2.   The following is an example of a non-behavioural constraint:

‘The memory requirements of the software must not exceed 3TB.’

  1.   Requirements creep can be avoided by employing a methodology of iterative prototyping.
  2.   The requirements document usually contains information about testing the system.
  3.   The following is an example of an acceptance test.

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

 

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

  1.   A recursive association is one via which an object of one class may be linked to more than one object of another class.
  2.   A condition stating the maximum number of patients that a consultant can be responsible for would give rise to an invariant in the M256 Hospital System.
  3.   In M256, each invariant in the conceptual model gives rise to a corresponding invariant in the initial structural model.
  4.   If there is an association between two classes X and Y, then at any given time there must be an instance of X which is linked to at least one instance of Y.
  5.   A multiplicity specifies how many links of an association there can be.

 

Question 5         The following is an extract from a requirements document for a system for a tap dance school. The incomplete class diagram below forms part of a conceptual model for the system.

Based on the information provided in figure 2, which two of the following statements are true? (Select two options)

  1.   The class  Pupil  generalises the class  Novice.
  2.   The multiplicity of the  leads  association at the  Instructor  end  should be 1..10.
  3.   The multiplicity of the  leads  association at the  TapClass  end should  be 10.
  4.   Up to 10 pupils can participate in a particular Tap class.
  5.   It is not possible for a  Novice  object to be linked to a  TapClass  object.

 

Question 6         The following is an extract from a requirements document for a property management company’s system. The incomplete class diagram below forms part of a conceptual model for the system.

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

  1.   The missing multiplicity of the  rents  association at the  Property  end is 0..*
  2.   rents  is a derived association.
  3.   The following is an invariant that is required in addition to the class  diagram, as part of the conceptual model:

Each Tenant object must be linked to at least one Property object via rents.

  1.   The following is an invariant that is required in addition to the class  diagram, as part of the conceptual model:

If a LandLord object aLandLord and a Property object aProperty are linked via owns, aLandlord and aProperty are linked via rents.

  1.   The following is an invariant that is required in addition to the class  diagram, as part of the conceptual model:

If a LandLord object aLandLord and a Property object aProperty are not linked via rents, then aLandlord and aProperty are linked via owns.

 

 

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

  1.   A method’s post-condition should state what invoking the method  achieves.
  2.   The specification of a component should include a description of any  other components it depends on.
  3.   Encapsulation involves protecting an object’s implementation details by  restricting access to them.
  4.   Assigning private accessibility to all instance variables is all that is  required to prevent privacy leaks.
  5.   If there is no explicit modifier in front of a Java class member then the  member can be accessed from outside the class’s package.

 

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

  1.   When a class,  P, is reused by composition by another class,  Q, this is  achieved by each instance of P having an instance of Q as part of its state.
  2.   An immutable collection in Java does not have any public methods.
  3.   A copy constructor may be used to create defensive copies of objects.
  4.   If a use case requires information to be returned to the user, then it will be easier to adapt the system to future changes if the core system returns the information to the user interface in the form of core objects rather than attribute values.
  5.   Enumerated types in Java are used to implement sorted sets of  numbers.

 

 

Question 9    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 in figure 5. (Select one option)

A.        X is DINNER;  Y is    customer7; Z is table2
B.        X is LUNCH;  Y is    customer3; Z is    table2
C.        X is LUNCH;  Y is customer3; Z is table4
D.        X is DINNER; Y is customer3; Z is table4
E.        X is LUNCH;  Y is    customer7; Z is    table4

 

Question 10       On the basis of the information above which two of the following statements are true? (Select two options)

  1.   reservation6  is not linked to any  Table  object.
  2.   Step 2 of the walk-through is carried out by  restaurant.
  3.   Step 4 of the walk-through is carried out by  restaurant.
  4.   Step 4 of the walk-through is carried out three times.
  5.   table2 is linked to customer3.

 

Question 11       On the basis of information provided in figure 5, which two of the following statements are true? (Select two options)

A.   A method whose specification begins as follows is appropriate for the protocol of RestaurantCoord:           Customer getCustomer()

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

Map getTablesAndCustomers(M256Date aDate, Sitting aSitting)

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

Map getTablesAndCustomers(M256Date aDate, Sitting aSitting)

D.   A method whose specification begins as follows is appropriate for the protocol of Sitting:

Sitting getSitting()

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

Table getTable()
 


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

  1.   An invalid scenario is a scenario in which a pre-condition is not met.
  2.   The coordinating object is the information expert for all of the tasks  required of the core system.
  3.   If a class  Q  has a method which takes as an argument an object of  class P, then the classes Q and P are coupled.
  4.   Allocation of responsibility to the information expert for a task tends to  lead to designs with relatively lower cohesion.
  5.   A design based on cascading usually introduces unnecessary coupling.

 

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

  1.   A utility class is not specific to the particular system under  development, but has potentially wider applicability.
  2.   The Java documentation for the  toString()method in class  Object  recommends that where toString() is overridden, compareTo() and hashcode() are overridden to be consistent with toString().
  3.   If an instance variable references an immutable object then the  instance variable cannot be given a different value.
  4.   The term composition relates to a situation where a class is composed  of a number of subclasses.
  5.   If a  compareTo()  method is specified in a class then it is good  practice to ensure it is consistent with the equals() method for that class.

 

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

  1.   Regression testing is only carried out while the system is being  developed.
  2.   A use-case driven approach to implementation minimises the need for  regression testing.
  3.   Black box testing is an example of verification testing.
  4.   In unit testing a boundary value can be defined as a point at which the  software’s specification indicates that there should be a significant change in the behaviour.
  5.   White box testing is a form of validation testing.

 

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.   A  toString()  method for each class is normally implemented in the  first code iteration.   
  2.   Getter methods for attributes for each class are normally implemented  in the first code iteration.
  3.   Derived attributes should not be implemented in the first code iteration.
  4.   Implementing the methods required for a particular use case is always  based on a single scenario.
  5.   In the first code iteration any method which is common to the designs  for all use cases should be implemented.

 

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

  1.   For a widget to have good affordance it must be clear in advance what  the effects of operating it will be.
  2.   Think-aloud is an alternative to direct manipulation for user interaction  as it is not based on the metaphor of physical manipulation.
  3.   To say that a widget has good visibility means it is apparent how to use  that widget.
  4.   In the context of user interfaces, efficiency can be measured in terms of  the time taken to complete a task.
  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.   Functionality refers to the extent to which a system can be used to  achieve goals efficiently and effectively.
  2.   Design heuristics are not typically universally applicable.
  3.   ’Extraordinary’ HCI refers to a set of interactive products that have  exceptionally good affordance.
  4.   A user interface should be considered alongside the tasks to be  performed.
  5.   All graphical user interfaces use direct manipulation.

 

Question 18       In the M256 approach to building a graphical user interface (GUI), which two of the following statements are true? (Select two options)

  1.   A coordinating object acts as a server to the GUI.
  2.   Determining what data is required to initialise each component of the  user interface is the responsibility of the end user and not the GUI implementer.
  3.   When developing a GUI, the implementation stage includes determining what kinds of information should be displayed on each screen.
  4.   Acceptance testing is normally carried out on an ongoing basis during  the development of the GUI.
  5.   Java’s Swing components have characteristics that are typical of  reusable components.

 

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

  1.   The Rational Unified Process (RUP) is an example of a waterfall  approach to developing software.
  2.   In large systems, UML package diagrams can be very useful for  keeping track of dependencies between different system components.
  3.   In a classic three-tiered architecture, the business domain tier is the  back end tier.
  4.   The Singleton pattern is an example of a behavioural design pattern.
  5.   Concurrency control is the regulation of access to shared data.

 

 

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

  1.   The concept of coupling can help you decide where to locate  responsibilities for managing concurrent access.
  2.   When a core system implements many complex use cases, there might  be a coordinating class and a coordinating object for each use case.
  3.   One disadvantage of tiered architecture is that it makes reuse more  difficult.
  4.   All agile software development methods follow the eXtreme  Programming approach.
  5.   The Publish-Subscribe design pattern provides a solution to the  following problem:

Different objects need to react to changes in another object to which they are otherwise unrelated.

 

 

PART 2

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

 

Question 21       The following is an extract from a requirements document for a part of a school’s assessment handling system for a single year group in a single school year. This part of the system deals with exams and assignments, scripts of which are submitted by students and marked by teachers.

System domain

There are two kinds of assessment handled by the system: exams and assignments. Each piece of assessment, either an exam or an assignment, tests one subject taught at the school. Each subject is tested by at least two pieces of assessment. Each exam is authored by exactly two teachers, each of whom must teach the subject tested by the exam. Teachers are employed to teach at least one subject. Some teachers do not author exams, but those who do are allowed to author at most four in any one year. No record is kept of the authorship of assignments. Each assessment is checked by one teacher who teaches the subject being assessed and the teacher who has checked the assessment is recorded. Exams cannot be checked by their authors.

Students, who study at least five and at most ten subjects, submit scripts for at most four pieces of assessment for each subject that they study. Each script a student submits is for a different piece of assessment. Students do not submit scripts for assessment of subjects that they do not study.

Each script is marked by one teacher who is allocated when the script is submitted. A teacher may mark any number of scripts but only for assessments in subjects that they teach. Each script is awarded a mark out of one hundred which is recorded.

Use cases

List scripts submitted for a subject. The user identifies a subject. The system displays the name of the subject and for each script for each assessment testing that subject, the ID of the student who submitted the script, the assessment code, the submission date of the script and the name of the teacher marking the script.

Record new assignment. The user identifies the subject tested by the assignment. The user provides the assessment code and assessment date and the last extension date, beyond which assignment script submissions are not allowed. The system records that there is a new assignment for the subject together with all the relevant information provided.

  1. Explain why it is not necessary to use a class to model the event of a teacher checking an exam. (2 marks)
     

Note that in 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 6 is an incomplete class diagram for a conceptual model with five classes unnamed and all the associations omitted.

 

  1. Copy the incomplete class diagram in Figure 6 into your answer book. Identify the five missing classes and put appropriate names for them into the five blank rectangles in your diagram. (2 marks)
     
  2. (i) Now complete the class diagram for the conceptual model that you began in (b). (9 marks)
    (ii) Write the class descriptions required for a conceptual model for the system. This should involve the classes in Figure 6 above, along with the classes identified in your solution to part (b), and no other classes. You should omit all comments. (4 marks)

 

  1. State an invariant that should be included in your conceptual model to express the constraint that an exam cannot be checked by its author. (2 marks)

     

  2. State in real-world terms a constraint that is given 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 hotel administration system.

HotelCoord is the coordinating class.

The following extract from the textual part of the structural model being developed omits some details that are not relevant for this question.

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

Note that the system deals with only a single hotel and each reservation is for only one night in one room.

Cancel a reservation

The user identifies a guest and a hotel night. If there is no reservation for the guest for the hotel night, the user is informed of this. Otherwise, the loyalty points of the guest are reduced by 1 and the reservation that is to be cancelled and all information about it is removed from the system.

The object diagram in Figure 8 shows the relevant objects and links for a particular scenario of the use case, before the use case is initiated.

  1. Draw an object diagram showing the relevant objects and links after the use case has completed, with the identified objects being guest3 and hotelNight7. Only attributes whose values have changed need to be shown. 2 marks)
  1. Write out 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)), any pre-condition and the post-condition. (3 marks)
     
  2. Consider the following incomplete walk-through for the scenario above for cancelling a reservation where the identified Guest object is guest3 and the identified HotelNight object is hotelNight7

  1. Identify all the navigations required for the first three steps of the walk-through. Some of the required navigations may already be shown in the class diagram in Figure 7. For each navigation that you identify, write down the name of the association and the direction in which it needs to be navigated.
  2. Complete the above walk-through. Write down the remaining steps as your answer in the answer booklet. (6 marks)

 

  1. Complete the following sequence diagram for the above scenario, based on the walk-through above. Note that hotel is the coordinating object. Annotate the diagram with numbers to indicate where each walk-through step is achieved.

Give the complete sequence diagram in your answer book.

  1. Now consider the following scenario for the same use case. The object diagram represents the situation before the use case is initiated.

 

 

Question 23       (20 marks)

Consider the class diagram in Figure 11 and class descriptions, extracted from  an implementation model for a small airline administration system, the Airline System. Then answer part (a) which follows. 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 three parts, (b), (c) and (d), are based on dynamic models which are given later.

The Figure 11 class diagram and following class descriptions are part of an implementation model for the Airline System.

  1. Table 1 sets out a test case specification for a test of the method book(aPassenger, aFlight) in the class AirlineCoord.

Read the table and the following notes and then complete the body, given below, of the JUnit test method test1Book corresponding to the test case.

Notes:

  • Your answer should consist of the missing code in the try and catch blocks.
  • You should assume that except for the method being tested 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 should use the Booking constructor directly in order to create booking7, the Booking object required for the fixture.
  • You are not required to provide Javadoc, or any other comments. (7 marks)

One use case in the Airline System is the following:

Book Flight for Existing Passenger

The user identifies a passenger and a flight. The flight must not have been booked already by the passenger. If the flight is already fully booked then the user is informed of this but otherwise the system records the booking of the passenger for the flight with the date of the booking.

The following are dynamic models for a design for the above use case. Use the scenario illustrated in the object diagrams in Figures 12 and 13 and the walk-through, and sequence diagram in Figure 14 for the scenario to answer parts (b), (c) and (d) which follow.

  1. Suggest a suitable order for implementing the methods and constructor required for the design of the use case Book Flight for Existing Passenger. (Note that as the specified Booking constructor is quite complex, it would not be implemented as part of the first code iteration, but as part of implementing the Book Flight for Existing Passenger use case.)

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. (4 marks)

  1. Write the code for the method isBookedOn(aFlight) specified in the class Passenger, based on the above dynamic models. You are not required to provide the method header or Javadoc comments. (4 marks)
  1. Write the code for the method book(aPassenger, aFlight) of the class AirlineCoord, according to the specification and designs given in the implementation model. You are not required to provide the method header or 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)
  1. 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)
  2. Explain the difference between a design principle and a design heuristic. (2 marks)
  3. Explain briefly what kinds of information are usually contained in an initial widget table. (3 marks)

 

  1. This part of the question is about a Java GUI for part of a company’s order system. Specifically, it is about building a screen for recording the removal of an order. Each order placed with the company has a unique identification number and a date by which the order is due (as well as other information about the order with which this question is not concerned). Many orders may be due on the same date.

The Remove Order screen allows the user to initiate the Remove Order use case. Here is a description of this use case.

The user identifies the order. All information relating to that order is removed from the system.

Imagine that a user interface designer has worked on the Remove Order use case and has decided that the user will select from a scrollable list of all order due dates. When the user makes this selection a second scrollable list will display, for each order with the selected due date, the unique identification number of that order.

The user then selects the relevant identification number from the second list and clicks the Remove Order button to remove the order.

This is illustrated by the design sketch in Figure 16.

When this design is implemented the GUI will communicate with a core system which, as well as a class Order, defines a coordinating class CompanyCoord.

Below are extracts from the Javadoc for some of the methods of these classes.

Class CompanyCoord

Method summary:

getOrders

public java.util.Collection getOrders()

Returns all orders placed with the company.

Returns:

a collection of all the Order objects

remove

public void remove(Order anOrder)

Records the removal of the order corresponding to anOrder.

This is the coordinating method for Remove Order.

Parameters:

anOrder – an order

getOrdersForDate

public java.util.Collection

getOrdersForDate(M256Date aDate)

Returns all orders due on the given date.

Returns:

a collection of all Order objects with dueDate value aDate

Class Order

Method summary:

getDueDate

public M256Date getDueDate()

Returns the due date of this order.

Returns:

dueDate

getIdNumber

public String getIdNumber()

Returns the identification number of this order.

Returns:

idNumber

  1. Write code for the body of a helper method displayAllDueDates() for the GUI class which displays in the first list the due dates of all the company’s orders, with the first date in the list selected by default.

Although several orders may have the same due date, each date should be listed only once. The dates are not required to be displayed in chronological order.

You should assume that:

  • the coordinating object is referenced by a variable company; the first list is referenced by a variable dateList of type M256JList;
  • when this list is populated with a collection of M256Date objects, the required information for each object in the required format i.e. dd/mm/yy will automatically be displayed in the list;
  • a Java set cannot contain two distinct M256Date objects which represent the same date. (5 marks)
     
  1. Write code for the body of a method displayIdNumbersForDate() to handle the selection of an item from the first list. You can assume that there is dateListValueChanged() handler method that invokes displayIdNumbersForDate().

The displayIdNumbersForDate() method should display, in the second list, the identification number of each order with the selected due date, with the first identification number in the list selected by default. You should assume that:

  • the second list is referenced by a variable idList of type M256JList;
  • when this list is populated with a collection of Order objects the idNumber value of each object will automatically be displayed in the list. (3 marks)
  1. Write code for the body of a handler method for the Remove Order button. The method should
  • record the removal of the order selected in the second list
  • repopulate both the first and second lists to reflect the removal of the order
  • inform the user that the removal has been successful in the message area at the bottom of the screen, which is referenced by a variable messageArea of type JTextArea.

You can assume that an order has been selected in the second list. You do not need to be concerned with what happens when the very last order is removed. (3 marks)

 

[END OF QUESTION PAPER]

 

Purchase full paper by adding to cart

Last updated: Sep 02, 2021 12:21 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