

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


(NFQ – Level 9)
Answer THREE questions ONLY. Show all work. This exam is open book All questions carry equal marks. Paper total: 90
Examiners: Mr. K. Grabe Dr. B. Wu Dr. J. F. Power
Q1 (a) Discuss the motivation for inheritance. Explain its advantages, disadvantages and alternatives when planning to extend the functionality of a class. (15 marks)
(b) Why is abstraction vital to sucessful object oriented design? Describes the steps, from an abstraction point of view, a developer should take during system development. Ilustrate with a simple example. (15 marks)
Q2 (a) Describe how generics helps the software developer and outline the major advantages it provides. Illustrate your points with two examples, one without generics and the other with generics. (15 Marks)
(b) Design patterns have been grouped into three categories: creational, structural and behavioural. Present one pattern from any two of these groups and discuss their intent, motivation, applicability and consequences. Illustrate usage of one of your chosen patttens. (15 Marks)
2
Q3 (a) Define a framework in the software development context. Illustrate how a framework of your choice fits your definition. (5 marks)
Compare three mechanisms that can be used to traverse a collection such as Java’s collection framework. (10 marks)
Write your own code, using Java’s collection framework or similar, to create two generic lists, A and B. Write a generic method to remove all the elements in list A that are also found in list B. (15 Marks)
Q4. (a) List possible approaches, with advantages and disadvantages, you could take to develop a custom GUI component. Develop a custom GUI component that can draw itself as one of three different shapes: A rectangle , a rounded rectangle or an oval. The custom component has a setShape (int shape) method that takes a single int parameter. Passing this parameter sets the appearance as follows: 1 = rectangle, 2 = rounded rectangle, 3 = oval. The appearance of the component can be changed in two ways: 1. by invoking the setShape ( ) method , 2. by clicking on the component. When the user clicks on the component it changes it’s appearance to the next shape in the following sequence: Rectangle – Rounded Rectangle – Oval – Rectangle etc. Note that the JPanel class has the following method: addMouseListener( MouseListener l)
(15 marks)
(b) What is a software component? The following screen-shot shows some graphical user interface components.