UNIVERSITY EXAMINATIONS: 2017/2018
EXAMINATION FOR DEGREE OF BACHELOR SCIENCE/BUSINESS
BIT2108 BBIT203 OBJECT ORIENTED PROGRAMMING
MODE: FULL TIME/PART TIME/DISTANCE LEARNING
DATE: APRIL, 2018 DURATION: 2 HOURS
INSTRUCTIONS: Answer Question ONE and any other TWO questions
QUESTION ONE [30 MARKS]
a) Explain what is meant by the term method signature.
b) Differentiate between class and structure. With an example explain the syntax for defining a class
c) Write a C++ program to illustrate multiple inheritance.
d) Differentiate between stream insertion and stream extraction operators.
e) Describe the following concepts as used in object oriented programming.
i. Operator overloading
ii. Function call
iii. Message passing
iv. Function overriding
f) Write a C++ program to print odd numbers greater than 0 and less than 1000.
g) How is program modularization achieved in C++.
QUESTION TWO [20 MARKS]
a) Define the term function overloading.
b) Explain how function calls are matched with overloaded functions.
c) Write a C++ program that uses function overloading to calculate and display area of circle and
rectangle using the formulas circle Area= 3.142*radius*radius and rectangle Area= length*width.
d) Discuss TWO advantages of overloaded functions in C++ program.
QUESTION THREE [20 MARKS]
a) Differentiate between early binding and late binding, with an example explain how late binding can
be achieved in C++.
b) Describe the concept of template classes in C++. Give an example.
c) Describe the concept of function abstraction in object oriented programming.
d) Describe how function abstraction can be realized in C++.
QUESTION FOUR [20 MARKS]
a). Discuss the concept of polymorphism in object oriented programming.
b). Briefly explain the following terms as used in inheritance:
i. Single inheritance
ii. Multiple inheritance
iii. Hierarchical inheritance
c). Define pure virtual functions. Write a C++ program to illustrate pure virtual functions.
QUESTION FIVE [20 MARKS]
a). Write a program in C++ that calculates and displays the weekly salary for an employee who earns
Kshs 2500 an hour, works 20 regular hours, 10 overtime hours, and earns time and one-half (wage *
1.5) for overtime hours worked. Create a separate method to do the calculation and return the result
to be displayed. Your program should contain a class that holds the employee details indicated as
well as the method to do the computation
b). Describe the concept of inline function in C++.
c). Discuss the concept of message passing in object oriented programming.
d). Using function write a program in C++ to take two arrays of integer numbers and multiply each
corresponding values and put the result in a third array.