BBIT203 BIT2108  OBJECT ORIENTED PROGRAMMING.

UNIVERSITY EXAMINATIONS: 2018/2019
EXAMINATION FOR BACHELOR OF SCIENCE IN INFORMATION
TECHNOLOGY/
BACHELOR OF BUSINESS INFORMATION TECHNOLOGY
FULL TIME/PART TIME/DISTANCE LEARNING
BBIT 203/BIT 2108: OBJECT ORIENTED PROGRAMMING
DATE: AUGUST, 2019 DURATION: 2 HOURS
INSTRUCTIONS: Answer QUESTION ONE and any other TWO.

QUESTION ONE [30 Marks]
a) Explain the concept of object technology as used in application development.
4 Marks
b) Explain at least five features in any object oriented programming language that
support object technology
5 Marks
c) With help of a sample program describe the structure of C++ program.
8 Marks
d) Explain how the concept of client-server is used in C++ program.
4 Marks
e) Differentiate between structure and class as used in C++. Give examples to support your
argument.
4 Marks
f) With appropriate example describe what is function overloading.
5 Marks
QUESTION TWO [20 Marks]
a) Debug the following program.
#include<ionstream.r>
main ( )
{
cout<<”enter two numbers:”; //prompt
cin>> number1; //Read number
float number 1, number 2,sum, average;
cin>>number 2; //from keyboard
average=sum/2;
sum=number 1+number 2;
void;
cout<<”sum=”<<sum<<”\n”;
cout<<”average=”<<average<<”\n”;
}
}
6 Marks
2
b) Find the errors in the following function prototype.
i). float average(a,b);
ii). int mul(int a,b);
iii). int display();
iv). void vect(int&v,int&size);
v). void print(float data[],size=20);
5 Marks
c) State with a reason whether the following statements are true or false.
i). Function argument is a value returned by the function to the calling
program.
ii). When a function returns a value, the entire function can be assigned to
variable.
iii). When argument is passed by value the function works with the original
arguments in the calling program.
iv). A function can return a value by reference.
v). When argument is passed by reference, a temporary variable is created in the
calling program to hold the argument value.
5 Marks
d) Explain the following terms as used in object technology
i). Message passing
ii). Methods
iii). Object
iv). Polymorphism
4 Marks
QUESTION THREE [20 Marks]
a) What is operator overloading and why do we use this concept. Give the general
syntax that is used to implement operator overloading.
4 Marks
b) Create a class named Shirt with data fields for collar size and sleeve length.
Include a constructor that takes arguments for each field. Also include a String
class variable named material and initialize it to “cotton”. Write a program
TestShirt to instantiate 3 Shirt objects with different collar sizes and sleeve
lengths, and then display all the data, including material, for each shirt.
10 Marks
c) Explain using an example how classes help to achieve program modularization.
6 Marks

QUESTION FOUR [20 Marks]
a) Write methods for bank operations such as recording customer’s details, recording
deposits and withdrawals. (Methods are declared within a class, main() is outside
the class)
Program should have the following:
Methods
Get details
Make deposit

Make withdrawals
Enquiry(optional)
Main()
10 Marks
b) Explain how you could modify the above program to achieve data hiding.
5 Marks
c) Differentiate between intrinsic and user defined data type as used in C++. Give two
examples in each case.
5 Marks
QUESTION FIVE [20 Marks]
a) Write a program to capture student’s details. In your program include the
following.
i. A constructor function
ii. A destructor and
iii. Other member function you may find necessary
10 Marks
b) Discuss the following types functions as used in C++
(i) Inline function
(ii) Friend function
(iii)Constructor function
(iv) Virtual function
(v) Recursive function
10 Marks

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

Written by