BSC (Hons) Applied ICT - OOP - MOCK
BSC (Hons) Applied ICT - OOP - MOCK
BSC (Hons) Applied ICT - OOP - MOCK
EXAMINATIONS FOR:
COHORT:
DURATION: 2 HOURS
INSTRUCTIONS TO CANDIDATES
Page 1 of 4
ANSWER ALL 3 QUESTIONS
b) Briefly describe the core concepts of Object Oriented Programming, and how does
it differ from traditional programming?
[5 MARKS]
[10 MARKS]
[10 MARKS]
Page 2 of 4
QUESTION 2 [35 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]
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]
Page 4 of 4