You are on page 1of 4

8

Open University of Mauritius

BSc (Hons) Applied ICT with Specialisation

MOCK Exam Paper

EXAMINATIONS FOR:

COHORT:

MODULE: OBJECT ORIENTED DESIGN AND


PROGRAMMING

MODULE CODE: OUbs017214

DURATION: 2 HOURS

INSTRUCTIONS TO CANDIDATES

1. This paper consists of 3 Structured Questions

2. Answer ALL questions

3. Always start a new question on a fresh page.

4. Total marks: 100.

This question paper contains 3 Structured Questions and 4 pages.

Page 1 of 4
ANSWER ALL 3 QUESTIONS

QUESTION 1 [35 MARKS]

a) Define the following terminologies as used in Object Oriented Programming and


provide an example of each:
a. Method
b. Instance Variable
c. ArrayList
d. Class instantiation
e. Thread
[10 MARKS]

b) Briefly describe the core concepts of Object Oriented Programming, and how does
it differ from traditional programming?
[5 MARKS]

c) Describe the concept of Inheritance and provide an example in java.

[10 MARKS]

d) Describe the concept of Encapsulation and provide an example in java.

[10 MARKS]

Page 2 of 4
QUESTION 2 [35 MARKS]

a) Explain the concept of polymorphism with the help of an example.


[10 MARKS]

b) Using the collection of LinkedList, write a java program that will declare, and insert
5 values in an LinkedList called Products. The program should then display the size
and the fourth element of the LinkedList.
[8 MARKS]

c) List five common examples of exceptions and explain what happens when a Catch
block throws an Exception?
[5 + 3 MARKS]

d) Propose a use case diagram for an ATM machine for withdrawing cash. Make the
use case simple yet informative; only include the major features like
withdraw, deposit, transfer, view/ print statement, Configure and Read logs.

[4 MARKS]

e) Draw a sequence diagram representing the process of making a phone call


from a cell phone. Hint*: The objects involved include the caller, the phone
network, the receiver of the phone call, and the cell phone accounting
department
[5 MARKS]

Page 3 of 4
QUESTION 3 [30 MARKS]

Description of the classes Shape, Circle, Rectangle and CreateShapes are given below:

i. Implement a class Shape that stores the following information about a shape. The
class Shape has protected data fields: name of type string, colour of type string.
The class Shape contains a constructor that takes the name and colour of the
shape as parameters, a pure virtual function getArea() and a display() function
that displays the details of the shape.
[8 marks]

ii. Implement a class Circle that inherits from Shape. The class Circle contains a
private field radius and constructor that takes the name, colour and radius of the
circle as parameters and intialises all fields. Moreover it contains a getArea()
function that returns the area and a display() function that displays the details of
the circle object.
[8 marks]

iii. Implement a class Rectangle that inherits from Shape. The Rectangle class will
have the length and breadth as fields. The class Rectangle contains two
constructors, namely one that takes the name, colour and the two sides of a
rectangle as parameters and the other that takes the name, colour and the length
of a square (a special rectangle with equal sides) as parameters. Moreover it
contains a getArea() function that returns the area of the rectangle and a display()
function that displays the details of a rectangle object.
[8 marks]

iv. Implement a class CreateShapes that creates a circle object and two rectangle
objects with following information:

circle blue 3 cm
square red 78 cm
rectangle green 45 cm 23 cm

The above class should display all the details and the area of each shape.

[6 marks]

END OF QUESTION PAPER

Page 4 of 4

You might also like