HCT 0201: OBJECT ORIENTED PROGRAMMING TECHNIQUES Past Paper

W1-2-60-1-6
JOMO KENYATTA UNIVERSITY
OF
AGRICULTURE AND TECHNOLOGY
University Examinations 2014/2015
STAGE III END OF SEMESTER EXAMINATION FOR
THE DIPLOMA IN BUSINESS INFORMATION TECHNOLOGY
HCT 0201: OBJECT ORIENTED PROGRAMMING TECHNIQUES
DATE: AUGUST 2014 TIME: 1½ HOURS
INSTRUCTIONS: ANSWER THREE QUESTIONS.

Question One (20 Marks)

a) Explain the following characteristics of C++ programming as a language:

(i) Object – oriented (2 Marks)

(ii) Portable (2 Marks)

(iii) Modular (2 Marks)

(iv) Speed (2 Marks)

b) Explain the following parts of a C++ program:

(i) # include < iostream> (2 Marks)

(ii) using namespace std (2 Marks)

(iii) int main ( ) (2 Marks)

(iv) return O (2 Marks)

c) Write a program in C + + that reads three integers input by user via keyboard and outputs the greatest among them. (4 Marks)

Question Two (20 Marks)

a) Explain the following concepts of OOP.

(i) Inheritance (2 Marks)

(ii) Polymorphism (2 Marks)

(iii) Encapsulation (2 Marks)

(iv) Abstraction (2 Marks)

b) Write a program of your choice that implements polymorphism as a concept of OOP. (6 Marks)

c) Giving an example or scenario, discuss the following programming errors: (6 Marks)

(i) Syntax

(ii) Logic

(iii) Semantic

Question Three (20 Marks)

a) Define the following terms:

(i) Object (1 Mark)

(ii) Class (1 Mark)

(iii) Method (1 Mark)

(iv) Function (1 Mark)

b) Explain the following programming methodologies as used in OOP.

(i) Top down (2 Marks)

(ii) Bottom up (2 Marks)

c) Write a program the name of a day in a week: upon number which is entered by via keyboard using switch statement. (Take 1 to start by outputting Monday). (4 Marks)

d) Explain the main difference between the WHILE statement and DO WHILE looping statements. (2 Marks)

e) Explain the following statements as used when using functions:

(i) Call by Reference (2 Marks)

(ii) Call by value (2 Marks)

(iii) Inline function (2 Marks)

Question Four (20 Marks)

a) Highlight three things you should consider when declaring an array. (3 Marks)

b) Explain four advantages of using pointers in OOP. (4 Marks)

c) Explain what the following terms mean as used in a structure of a class:

(i) Private (2 Marks)

(ii) Public (2 Marks)

(iii) Protected (2 Marks)

d) People argue that C++ is same as Java; only their syntax is different. To some extend it’s true since both are OOP languages. What are some of the similarities between the two languages? (4 Marks)

e) List and explain three datatypes used in C++ programming. (3 Marks)

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

Written by