0% found this document useful (0 votes)
23 views4 pages

OOP 2017july

revision material ict

Uploaded by

Charles Bryton
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
23 views4 pages

OOP 2017july

revision material ict

Uploaded by

Charles Bryton
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 4
easytvet.com 2920/203 OBJECT ORIENTED PROGRAMMING July 2017 Time: 3 hours THE KENYA NATIONAL EXAMINATIONS COUNCIL DIPLOMA IN INFORMATION TECHNOLOGY MODULE II OBJECT ORIENTED PROGRAMMING 3 hours INSTRUCTIONS TO CANDIDAT You should have an answer booklet for this examination: This paper consists of EIGHT questions. Answer any FIVE in the answer hooklet provided. All questions carry equal marks. Candidates should answer the questions in English. This paper consists of 4 printed pages. Candidates should check the question paper to ascertain that all the Pages are printed as indicated and that no questions are missing. © 2017 The Kenya National Examinations Council Turn over (b) we Wd) 3. fa) (bd) 4) 2920203 Saks 20> easytvet.com (i) Outline four charaeteristies of abstract data types (ADS). (4 marks) Gi) Explain the term message as used in OOP. (2 marks) With the aid of a C++ example in cach case. differentiate between a variable and a constant. (4 marks) Describe two circumstances under which the do. while fonp is most applicable in OOP. (4 marks) Write a C++ program that implements a class named msedass with the Following Features: (6 marks) Data members d and by; ‘A member function named se¢/ to assign characters “O" and ‘P* to a and respectively, and outputs a concatenation of w and 6. Explain the purpose of using the namespace std in C++ programs (2 marks) @ inguish between strucé and class data structures as used in C+ +, marks) Gi) Outline four categories of operators used in C+ giving an example in exch ease. (4 marks) Draw 2 program flowchart to show the execution logie of a while loop structure. (4 marks) Write x C1+ program that would implement a class with the dimensions of a cylinder as data members. The program should then accept the dimensions, determine and display the volume of the cylinder using a Iriend function. (G marks) Ouiline four typical features of object oriented programming that makes it popular in application development. (4 marks) (i) Explain two aims of object oriented analysis and design (OOD). (4 marks) (i) Differentiate between accessor operation and setter operation as used in OOP. {4 marks) Design two classes with relevant data and methods that can be used to manage the following communication model in a college. (8 marks) The Whaasup group directory of a college contains entries for each person in the college ice, student, tutor, and staff member. Users of the directory ean look up names, set phone number and chat. However. the administrator of the directory can, atter supplying a password, insert new entries, delete existing entries, modify existing entries, print the telephone directory, and print a listing of all students or of all members of stall. Explain the folowing terms as used in OOP: a) instantiation; {2 marks) Gi) access specitier. (2 marks) 2 easytvet.com (b) Describe the circumstance under whieh cack of the following C+* program elements are most applicuble: (Scope resolution operator: (2 maths Gi) Object parameter (2 marks) ©) Write a C+» program segment to demonstrate the use of Mis pointer ina constructor. nat ‘e! (4 marks) (@)— (i) Outline one advantage and one disadvantage of using overloaded fanetions in oop. (2 marks) (ii) Write a C++ program that will accept the dimensions of « cuboid and use an overloaded function called calculate to determine the eross-sectional area or volume of the cuboid. Display the area and volume accordingly. (6 marks) 5. (a) Outtine four rules of setting destructons in OOP. (4 marks) (>) (Explain two ways in which copy constructors are used in C++ programs. (4 marks) (i) Distinguish between sex file and data file as applied in C++ programs. (4 marks) (©) Write a C++ program that will initialize bvo objects, Obl (7, 8) and-Ob2 (2, 5), using a construetor. The program should then determine the dilerenee of the objects using an overloaded operator und display the values of resultant object. (8 marks) 6 (2) @)_List four operators that cannot be overloaded (2 marks) (ii) Outline two restrictions that must be considered when overloading operators in oop. (2 marks) (>) (Explain two benefits of using files in OO programs. (4 marks) (8) Distinguish between a sireant and a template class with respect to C4+ files, (4 marks) {c) Evaluate the following C+ statement clearly showing your working, 4 93132115 %T~2€1215*2-9/3 (2 marks) {d) Figure 1 shows the relationship between two classes, Write a €! + program to implement the relationship and output a. b and sum of all the data members. (6 marks) Data: a Methods: set a to 100; IY derives Data: b Methods: set b to 237; Figure 1 2920/203 3 Turn over duly 2077 7 @ ) © (b) {e) 2920/203 sfuly 2077 easytvet.com Explain the following terms as in inheritance: L override; (2 marks) I. variance. Q marks) Gi) Deseribe the circumstance under which a virtual base class is applicable in OOP. (2 marks) @ 's can be implemented using different open modes based on theit purpose Assuming C++ programming language, outline four values of the openmodes. 4 marks) (ii) Write a C++ program segment that would open a marks database file for reading, aficr verifying that it is open, and outputs the contents to the screen. Note that the file contains examination marks only. (4 marks) With the aid of an example in each case, explain three types of polymorphism applicable in OOP. (6 marks) (Write the C++ general syntax for a polymorphic class. G marks) Gi) Differentiate between abstract hase class and normal base class as used in OOP. (4 marks) (Sharing is the basic idea of inheritance. Justify this statement with respect to oop. G marks) (ii) A student intends to solve a programing problem using a constructor and a destructor in both the base and derived classes. With the aid of a C++ program segment, demonstrate the process of creating and deleting the respective objects. (6 marks) A software development company has adopted OOP in its current projects. Explain ‘two ways in which the company would use to cope with the emerging trends in OOP. (4 marks) THIS IS THE LAST PRINTED PAGE.

You might also like