W1-2-60-1-6
JOMO KENYATTA UNIVERSITY
OF
AGRICULTURE AND TECHNOLOGY
UNIVERSITY EXAMINATIONS 2015/2016
SECOND YEAR FIRST SEMESTER EXAMINATION FOR THE DEGREE OF
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY/
BACHELOR OF BUSINESS INFORMATION TECHNOLOGY
ICS 2104: OBJECT-ORIENTED PROGRAMMING I
DATE: APRIL, 2016 TIME: 2 HOURS
INSTRUCTIONS: ANSWER QUESTION ONE AND ANY OTHER TWO
QUESTIONS
QUESTION ONE (30 MARKS)
a) Distinguish between procedural programming and object oriented
programming. [2 marks]
b) State two disadvantages of the procedural programming paradigm.[2 marks]
c) Design the following terminologies with regard to OOP:
i) Object [6 marks]
ii) Class [2 marks]
iii) Encapsulation [2 marks]
iv) Abstraction [2 marks]
v) Inheritance [2 marks]
vi) Polymorphism [2 marks]
d) Write a simple C++ program that will display a sentence on
the console [4 marks]
e) Describe the following: [4 marks]
i) Insertion operator
ii) Extraction operator
f) Explain the meaning of the following OOP concepts:
i) Dynamic binding [2 marks]
ii) Operator overloading [2 marks]
iii) Function overloading [2 marks]
iv) Constructors [2 marks]
v) Destructor [2 marks]
g) Describe the general syntax of a function definition on C++ [4 marks]
1
QUESTION TWO (20 MARKS)
a) Describe the structure of a C++ program. [6 marks]
b) Write a program that allows the user to enter eight integer values.
Display the values in the reverse order of the order they were
Entered. [14 marks]
QUESTION THREE (20 MARKS)
a) Write a program that allows the user to enter two double values.
Display one of three messages: “The first number you entered
is larger”, “The second number you entered is larger”, or
“The numbers are equal”. [14 marks]
b) Discuss the following:
i) Object-based programming [3 marks]
ii) Object-oriented programming [3 marks]
QUESTION FOUR (20 MARKS)
a) Write a C++ program, to find the factorial of a number using
a constructor and a destructor. [16 marks]
b) Explain two major benefits of OOP. [4 marks]
QUESTION FIVE (20 MARKS)
a) Illustrate the concept of inheritance with the help of
a C++ program. [16 marks]
b) State four advantages provided by inheritance. [4 marks]