BIT 2108 OBJECT ORIENTED PROGRAMMING 1 KCA Past Paper

UNIVERSITY EXAMINATIONS: 2011/2012
YEAR 2 EXAMINATION FOR THE BACHELOR OF SCIENCE IN
INFORMATION TECHNOLOGY
BIT 2108 OBJECT ORIENTED PROGRAMMING 1
DATE: APRIL 2012 TIME: 2 HOURS
INSTRUCTIONS: Answer Question One and Any other Two Questions

QUESTION ONE
a) Briefly explain the following terms in the context object oriented programming.
i) Object oriented Programming (2 Marks)
ii) function prototype (2 Marks)
iii) encapsulation (2 Marks)
iv) Polymorphism (2 Marks)
b) Explain the meaning of ‘association’ concept in the context of object oriented programming. Write
c++ code about kcau student using ‘association’ concept. (4 Marks)
c) Briefly distinguish between direct and indirect base class. Write c++ code example to illustrate the
two concepts. (4 Marks)
d) What is Operator Overloading? Give one example in c++ (3 Marks)
e) Discuss switch statement with syntax and example. (4 Marks)
f) Describe the meaning of the term multiple inheritance? Write a program to implement multiple
inheritance. (5 Marks)
g) Distinguish between specialization and generalization concepts as used in object oriented
programming. (2 Marks)
QUESTION TWO
a) Briefly explain the meaning of the following object programming concepts
i) Class (2 Marks)
ii) Object (2 Marks)
iii) cout (2 Marks)
b) Describe three properties of a ‘constructor’ as used object oriented programming.
Write a sample c++ code that implements a class constructor (5 Marks)
c) Write a c++ program for computing circumference of circle using the following c++ tools
(5 Marks)
i. Class
ii. functions
iii. variables
d) Differentiate between private and public class. Elaborate with suitable example (4 Marks)
QUESTION THREE
a) Briefly explain the meaning of the following object oriented programming concepts
i) Polymorphism (2 Marks)
ii) Abstraction (2 Marks)
b) Explain the importance of stream classes as in c++ programming (2 Marks)
c) Briefly explain the purpose for each the following stream classes. (3 Marks)
i) i stream
ii) io stream
iii) o stream
d) Describe three advantages of object oriented programming methodology (3 Marks)
e) Write a program for computing the area of a rectangle and a circle using polymorphism concept
(5 Marks)
f)Explain the difference between prefix and postfix incremental operator. Give one example for each
operator (3 Marks)
QUESTION FOUR
a) Describe the meaning of ‘friend class’ concept in the context of object oriented programming
(3 Marks)
b) Briefly explain the following c++ code using comments (5 Marks)
#include <iostream.h>
Class centigrade
{
Public:
const float mult= 5.0/9.0;
const int sub = 32;
float fahr,cent ;
};
void main( )
{
cout<<“enter fareinheit temperature:”;
cin>> fahr;
cent=(fahr-sub) * mult;
cout <<“centigrade equivalent of “<<fahr<<“is”<<cent<<endl; }
c) Write a c++ program for capturing and displaying details of kcau_employee using classes and
inheritance concepts. (5 Marks)
d) Briefly explain three properties of static methods in the context of object oriented programming
(3 Marks)
e) Describe the meaning of the term ‘dynamic bidding’. Write a sample c++ code that implements
dynamic bidding. (4 Marks)
QUESTION FIVE
a) Briefly explain the meaning of the following object oriented programming concepts
i) Constructor (2 Marks)
ii) Aggregation (2 Marks)
iii)Composition (2 Marks)
iv)Main Function (2 Marks)
b) Describe the meaning of the term ‘overriding method’ in the context of object oriented
programming. Write a sample c++ code that implements overriding concept (4 Marks)
c) Describe the meaning of the term ‘overloading method’ in the context of object oriented
programming. Write a sample c++ code that implements overloading concept (4 Marks)
d) Write a c++ program that outputs grades A, B, C or D depending on Marks entered by a user of a
certain subject (4 Marks)

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

Written by