UNIVERSITY EXAMINATIONS: 2017/2018
EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE IN
BIT 2108: OBJECT ORIENTED PROGRAMMING
FULL TIME/PART TIME/DISTANCE LEARNING
DATE: DECEMBER, 2017 TIME: 2 HOURS
INSTRUCTIONS: Answer Question One & ANY OTHER TWO questions.
a) Software products should be evaluated carefully for their quality before they are delivered and
implemented. List down 5 quality issues that must be considered for critical evaluation.
b) To build today’s complex software it is just not enough to put together a sequence of
programming statements and procedures and sets modules. We need to incorporate sound
construction techniques and program structures that are easy to comprehend, implement and
modify. Describe FOUR of these techniques.
c) List FOUR features of Object Oriented Programming Languages that strikes out from
Structured Programming Languages
d) An Object Oriented program consists of a set of objects that communicate with each other. This
process involves THREE steps. Name them
e) Programming Languages must support several concepts of OOP to claim that they are object
oriented. With this regard, list some of the features that tell apart OBPL from OOP
f) In the light of Client/Server model, describe the structure of C++ Program.
a) Differentiate between implicit and explicit type conversion and how they are implemented
b) Write a program to print the following output
3 3 3
4 4 4 4
5 5 5 5 5
6 6 6 6 6 6
the number of time represented by an integer that the user inputs
c) Write a function power() to raise a number m to a power n. The function takes a double value
for m and int value for n, and returns the result correctly. Use a default value of 2 for n to make
the function calculate the squares when this argument is omitted. Write a main function show
how the function power() will be referenced
d) Differentiate between struct and class used defined type implementers
a) Describe the mechanism of accessing data members and member functions in the following
i. inside the main program
ii. inside a member function of the same class
iii. inside a member function of another class
iv. inside a derived class
b) Define a class to represent a bank account. Include the following members:
names of the depositor
type of account
balance amount in the bank.
to assign initial values
to deposit an amount
to withdraw an amount after checking the balance
to display name and balance.
Write a main program to test the program
a) Define a friendly function. What is its relevance in OOP? Can it be eliminated? If so how can
the concept be implemented?
b) Create two classes DM and DB which store the value of distances. DM stores the distances in
meters and centimeters and DB in feet and inches. Write a program that can read values for the
class objects and one object of DM with another object of DB.
Use a friend function to carry out the addition operation. The object that stores the results may
be a DM object or DB object, depending on the units in which the results are required. The
display should be in the format of feet and inches or meters and centimeters depending on the
object on display
a) Define a parameterized constructor? Give a statement showing how it is referenced
b) Can we have more than one Constructors in a class? If yes, explain the need for such a situation.
c) What do you mean by dynamic initialization of objects? Why do we need to do this?
d) Distinguish between the following two statements
i. time T2(T1);
ii. time T2=T1;
T1 and T2 are objects of time class
e) A bookshop maintains the inventory of books that are being sold at the shop. The list includes
details such as author, title, price, publisher and stock position. Whenever a customer wants a
book, the sales person inputs the title and author and the system searches the list and displays
whether it is available or not. If it is not, an appropriate message is displayed. If it is, then the
system displays the book details and requests for the number of copies required. If the requested
copies are available, the total cost of the requested copies is displayed; otherwise the message
“Required copies not in stock” is displayed.
Design a system using a class called books with suitable member functions and constructors.
Use new operator in constructors to allocate memory space required