UNIVERSITY EXAMINATIONS: 2016/2017
EXAMINATION FOR DEGREE OF BACHELOR SCIENCE INFORMATION
TECHNOLOGY/BACHELOR OF BUSINESS INFORMATION TECHNOLOGY
BIT 2108 BBIT 203 OBJECT ORIENTED PROGRAMMING
MODE: FULL TIME/PART TIME/DISTANCE LEARNING
ORDINARY EXAMINATIONS
DATE: AUGUST, 2017 DURATION: 2 HOURS
INSTRUCTIONS: Answer question ONE and any other TWO questions
QUESTION ONE [30 MARKS]
a) Describe the stages involved in developing an object oriented system.
[3 Marks]
b) Differentiate between class and structure. With an example explain the syntax for
defining a class
[3 Marks]
c) Write a C++ program to illustrate multiple inheritance.
[5 Marks]
d) Differentiate between stream insertion and stream extraction operators.
[4 Marks]
e) Describe the following concepts as used in object oriented programming.
i. Operator overloading
ii. Function call
iii. Message passing
iv. Function overriding
[8 Marks]
f) Write a C++ program to print odd numbers greater than 0 and less than 1000.
[4 Marks]
g) How is program modularization achieved in C++.
[3 Marks]
QUESTION TWO [20 MARKS]
a) Define the term function overloading.
[2 Marks]
b) Explain how function calls are matched with overloaded functions.
[6 Marks]
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.
[6 Marks]
d) Discuss TWO advantages of overloaded functions in C++ program.
[6 Marks]
QUESTION THREE [20 MARKS]
a) Differentiate between early binding and late binding, with an example explain how
late binding can be achieved in C++.
[6 Marks]
b) Describe the concept of template classes in C++. Give an example.
[5 Marks]
a) Describe the concept of function abstraction in object oriented programming.
[3 Marks]
b) Describe how function abstraction can be realized in C++.
[6 Marks]
QUESTION FOUR [20 MARKS]
a). Discuss the concept of polymorphism in object oriented programming.
[4 Marks]
b). Briefly explain the following terms as used in inheritance:
i. Single inheritance
ii. Multiple inheritance
iii. Hierarchical inheritance
[6 Marks]
c). Define pure virtual functions. Write a C++ program to illustrate pure virtual
functions.
[10 Marks]
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
[8 Marks]
b). Describe the concept of inline function in C++.
[3 Marks]
c). Discuss the concept of message passing in object oriented programming.
[2 Marks]
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.
[7 Marks]