BIT 2108 OBJECT ORIENTED PROGRAMMING.

UNIVERSITY EXAMINATIONS: 2017/2018
EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE IN
INFORMATION TECHNOLOGY
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.

QUESTION ONE
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.
5 Marks
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.
8 Marks
c) List FOUR features of Object Oriented Programming Languages that strikes out from
Structured Programming Languages
4 Marks
d) An Object Oriented program consists of a set of objects that communicate with each other. This
process involves THREE steps. Name them
3 Marks
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
6 Marks
f) In the light of Client/Server model, describe the structure of C++ Program.
4 Marks
QUESTION TWO
a) Differentiate between implicit and explicit type conversion and how they are implemented
4 Marks
b) Write a program to print the following output
1
2 2
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
6 Marks
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
8 Marks
d) Differentiate between struct and class used defined type implementers
2 Marks
QUESTION THREE
a) Describe the mechanism of accessing data members and member functions in the following
cases
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
8 Marks
b) Define a class to represent a bank account. Include the following members:
Data members
names of the depositor
account number
type of account
balance amount in the bank.
Member functions
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
12 Marks
QUESTION FOUR
a) Define a friendly function. What is its relevance in OOP? Can it be eliminated? If so how can
the concept be implemented?
6 Marks
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
14 Marks
QUESTION FIVE
a) Define a parameterized constructor? Give a statement showing how it is referenced
4 Marks
b) Can we have more than one Constructors in a class? If yes, explain the need for such a situation.
3 Marks
c) What do you mean by dynamic initialization of objects? Why do we need to do this?
3 Marks
d) Distinguish between the following two statements
i. time T2(T1);
ii. time T2=T1;
T1 and T2 are objects of time class
3 Marks
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
7 Marks

(Visited 92 times, 1 visits today)
Share this:

Written by