Get premium membership and access revision papers, questions with answers as well as video lessons.

Object Oriented Programming Question Paper

Object Oriented Programming 

Course:Diploma In Information Technology

Institution: Kca University question papers

Exam Year:2010



UNIVERSITY EXAMINATIONS: 2008/2009
STAGE IV EXAMINATION FOR DIPLOMA IN INFORMATION
TECHNOLOGY
DIT 405: OBJECT ORIENTED PROGRAMMING
DATE: APRIL 2010 TIME: 1½HOURS
INSTRUCTIONS: Answer any THREE questions
Question One
a) What is a variable (1 Marks)
b) Distinguish between the following terms
i. Struct
ii.Union (2 Marks)
c) What are the three major object oriented principles which are important in object oriented
programming (3 Marks)
d) What is meant by the following object oriented concepts
i. Abstraction
ii. Information hiding
iii. Operator overloading (6 Marks)
e) Give four basic advantages object oriented programming (4 Marks)
f) Define the following terms
i. An object
ii.A class (2 Marks)
g) Explain the following types of variables
i. Global variable
ii.Local variable (2 Marks)
Question Two
a) What is an exception (1 Mark)
b) Using relevant examples, explain three ways how you can handle exceptions (6 Marks)
c) Define the following terms
i. An overloaded constructor
ii. A copy constructor
(2 Marks)
e) What is the class method (1 Mark)
f) Distinguish between the following techniques using an appropriate example.
i. Pass by value
ii. Pass by reference (4 Marks)
g) Using a code example, explain how you can instantiate an array of object and how to use it to
access the class properties (4 Marks)
Question Three
a) What is polymorphism (1 Mark)
b) List two advantages of polymorphism (2 Marks)
c) One of the pillars of object oriented programming is inheritance. Briefly explain how
inheritance can be achieved in the following scenario using a code snippet.
“A rectangle, square, oval and a circle are all basic shapes. All these shape have
common methods called area and perimeter. A circle and an oval are closely
related” (5 Marks)
d) Explain the following methods of inheritance
i. Public inheritance
ii. Protected inheritance
iii. Private inheritance (5 Marks)
e) What is a virtual function (2 Marks)
f) Distinguish between early and late binding (2 Marks)
g) Consider the code segment below and identify the errors
(2 Marks)
Question four
a) Define the following terms
i) Source code
ii) Object code
iii) A linker
iv) Interpreter
v)A compiler (5 Marks)
b) What is a library (2 Marks)
c) Describe the following basic data types
i) Integer
ii) Double
iii) Character
iv)Array (4 Marks)
d) What is a pointer (1 Mark)
Write the expected output when this code is executed, explaining each statement (4 Marks)
f) Create a class called a calculator with the following properties and methods.
CALCULATOR
- float value1
- float value2
+void sum ( )
+void subtract ( )
+ void display ( )
Write the driver program that can be used to instantiate the class object and access the class method to
add two values, subtract, and display the final result. (4 marks)
Question Five
a) Define the following terms
i. Function overloading
ii. Operator overloading
iii. Friend function (3 Marks)
b) Write a complete program which combines a friend function setX, and which is used for setting
the private data member x of the class count to an integer number eight. The class also has a
constructor which initializes the data member x to zero and a member function print which
displays the value of x (10 Marks)
c) Distinguish between the following terms
i. Low level and high level language (2 Marks)
ii. What is a preprocessor directive (1 Mark)
5
d) By using a recursive function, write a program to solve the following problem
6!=6 x5x4x3x2x1 (4 Marks)
i. What is a recursive function (1 Mark)
ii. Identify and correct the errors in the following code segment
} (2 Marks)






More Question Papers


Popular Exams



Return to Question Papers