Object oriented programming November 2016 Past Paper – KNEC Diploma

Object oriented programming November 2016 Past Examination Question Paper – KNEC

This Past Paper examination was examined by the Kenya National Examination Council (KNEC) and it applies to the following courses:

  • Diploma in Information Communication Technology – Module II

Note: To easily navigate through the KNEC Past Examination Paper Pdf below, Mobile phone users are advised to use Mozilla or Chrome browsers








THE KENYA NATIONAL EXAMINATIONS COUNCIL
DIPLOMA IN INFORMATION TECHNOLOGY
OBJECT ORIENTED PROGRAMMING
November 2016
Time: 3 hours

1. a) Explain the way in which object oriented programming supports each of the following reasoning:
i. induction; (2 marks)
ii. deductive. (2 marks)
ii) Outline three typical steps in object oriented programming. (3 marks)
b) Distinguish between selector rind setter operations as used in OOP. (4 marks)
c) i) Define the term data abstraction as used in OOP. (1 mark)
ii) Peter, a module II student, is convicted that struct is an abstract data type. Explain four reasons to justify Peter’s position. (8 marks)

2. a) i) Outline four reasons why OOP is popular in software development. (4 marks)
ii) Describe dynamic binding as used in OOP. (2 marks)
b) Distinguish between state and behaviour of an object as used in OOP. (4 marks)
c) Study the following C++ program segment and answer the questions that follow.

i) Identify two errors in the program providing a possible solution in each case. (4 marks)
ii) Explain the implication of using each of the access specifiers in the program. (4 marks)
iii) Interpret the 4th line in the program segment.

3. a) Evaluate each of the following C++ statements (show your working).
i) b -12 + 4- 7 * 9 % 6 + 12/3 (2 marks)
ii) 13 – (8%5)>-9%7-3+6 *2 (2 marks)
b) i) Write a C++ program that accepts the radius of a circle and uses an inline function to determine the area of circle. The program should output the area of the circle. (4 marks)
ii) Describe the circumstance under which the following varieties of classes are used in OOP:
i) data managers; (2 marks)
ii) data source/sink. (2 marks)
(c) Write a C++ program that accepts the dimensions of a rectangle and a rhombus. The program should then use an overloaded function named area to determine area of the respective figures. Output the dimensions and areas of the figures. (8 marks)

4. a) (i) Explain the term recursive function as used in programming. (2 marks)
(ii) Distinguish between value and variable parameters as used with functions during C++ program writing. (4 marks)
(b) (i) List four rules that are applicable when using constructors in C++ programs. (4 marks)
(ii) Write a C program that will implement a class named arithmetic with three integers initialized to 5, 7 and 10 respectively and a member function used to determine and output the product of the integers. Use a parameterized constructor. (5 marks)
(c) Interpret the following C++ program segment. (5 marks)

5. a) (i) State two ways of using references in C++ programs. (2 marks)
(ii) Distinguish between friend function and function prototypes as used in C++ programs. (4 marks)
b) Explain three benefits of inheritance as applied in OOP. (6 marks)
(i) Helen would like to implement operator overloading in her system project. Outline two restrictions associated with operator overloading that she should consider. (2 marks)
(ii) Write a C++ program that will implement a class named matrix with following properties: (6 marks)
• data members as x and y;
• a constructor for initializing the matrix elements (x — 3 and y — 4);
• a member function for displaying the matrix elements;
• an overloaded operator function for determining the product of the matrix with a scalar that is input in the main program.
Note: The program should display the matrix elements of the product.

6. (a) (i) Explain the following forms of inheritance as used in OOP:
I. Extension;
II. Limitation.
(ii) Describe the circumstance under which each of the following concepts are most applicable in OOP:
i. Abstract class; (2 marks)
ii. Virtual function. (2 marks)
(b) Copy constructors are only used for initialization in OOP. Describe three occurrences of initialization where they are applicable. (6 marks)
(c) Write a C++ program that will write characters to a file until the user enters ‘$’ to stop. (6 marks)

7. (a) Outline four disadvantages of implementing inheritance in C++ programs. (4 marks)
(b) Distinguish between coupling and cohesion as used in OOP. (4 marks)
(c) Explain the term destructor as used in C++ programs. (2 marks)
(d) Write a C++ program that will carry out the following:
• define a class named circular that has data members named radius and height, a member function named set which is used to initialize the value of length and height and a virtual function named volume,
• implements a derived class from circular named cylinder whose radius and height are 14 cm and 10 cm respectively;
• implements a derived class from circular named cone whose radius and height are 14cm and 5 cm respectively;
• outputs the volume for the cylinder and cone.
Use pointers. (10 marks)

8. (a)Explain two reasons for using l/O files in OOP. (4 marks)
(b) Distinguish between overloading unary operators using member functions and using friend functions. (4 marks)
(c) The module III candidates have been advised to use OOP in their projects. Explain two measures that they should put in place in order to cope with the challenges in OOP.
(4 marks)
(d) Write a C++ program that uses an array of objects to generate the following output. Use for loop. (8 marks)
1      2
3     4
5     6
7     8

Share with your friends

Leave a Reply

Your email address will not be published. Required fields are marked *