KNEC Diploma in ICT module 2 Object Oriented Programming past paper: July 2013 Answers

Solved and verified

Course Name:  Information and Communication Technology
Also Done By:
NA
Course Level:  Diploma
Sub Level:       Module II
Course Unit:   Object Oriented Programming
Exam body:    KNEC

Share with Friends:
        
Go Back



1. Outline three characteristics of member function as used in object oriented programming languages. ()

2. Define the term operator overloading as used in object oriented programming ()

3. State two rules applied when overloading an operator ()

4. Outline three examples of derived data types as used in object oriented programming ()

5. Describe the term memory leak as used in object oriented programming ()

6. Distinguish between the following C++ program segments; (4 marks) string myname(“Ann Joy”); string myname=“Ann Joy”; ()

7. Explain one advantage of using free store in a C++ program ()

8. State two disadvantages of using modular programming approach when developing a program ()

9. The following is a C++ program segment, Use it to answer the questions that follows. #include class figure { Public: int shape(int dim) { return (dim*dim*dim); } }; int main ( ) { figure cub; int dimension; dimension=0; cout<<“Enter the dimension :”; cin>>dimension; cout<<“The shape volume is:”<)

10. Describe one rule of inheritance as applied in C++ programming language ()

11. Write a C++ program that has: •One class named shapes •Two objects named sphere and circle •A member function that calculates the area of a circle; •A member function that calculates the function that calculates the volume of a sphere The program should prompt the user to enter a radius, compute the area of a circle and the volume of the sphere using the radius entered and then output the radi ()

12. Outline two characteristics of objects as used in object oriented programming languages ()

13. Describe the term persistent object databases as used in object oriented programming language ()

14. state two ways of invoking a destructor function in object oriented programs ()

15. Distinguish between a class and a structure as used in C++ programming ()

16. Write a C++ program that prompts a user to enter a dimension of a square. The program should then compute the area of the square through an inline function and then output the area ()

17. State two advantages of using object oriented programming language when developing a system ()

18. Explain the term runtime polymorphism as used in object programming language ()

19. Differentiate between static binding and dynamic binding as used in C++ programming ()

20. Faith has been advised to overload the new and delete operators while coding a C++ program. Outline four advantages that she would gain from this approach ()

21. under what circumstance would the scope resolution operator be used in a C++ program. ()

22. Write a C++ program that has the following data members and member functions: Data members; •Account number •Amount of balance in the account Member functions: •Accept deposited amount •Default constructor to initialize the variables •Display account name and balance The program should accept account number and amount entered for depositing. The program should then output the account number a ()

23. Outline the function of each of the following classes as used in C++ programming language: (i)fstreambase; (ii)streambuf; (iii)filebuf. ()

24. With the aid of an example in each case, differentiate between simple data type and user defined data type as used in C++ programming ()

25. Given that the values of a, b, c and d are 4, 8, 1 and 2 respectively, evaluate the following C++ statement. (4 marks) X= (a%d)+(b*c)%a%d-#c^3# ()

26. Explain two uses of a static function as used in C++ programming ()

27. With the aid of an example in each case, differentiate between enumerated and typedef specifiers as used in C++ programming ()

28. Explain a circumstance under which a class inheritance would be used in Object Oriented programming language ()

29. The following are operators used in C++ programming language. || & ++ :: << Arrange them in the order of their execution precedence ()

30. Ox4b ‘p’ 3.14 30ul “Lengo” 85 Oxff 9008 Categorize them as an integer, character, string or floating point ()

31. Explain two rules to be observed when using virtual functions in object oriented programming language ()

32. State one reason that would justify overloading of an operator ()

33. Outline two circumstances that may lead to file operation failure during program execution ()

34. Mary would like to write a C++ program that outputs data of a file named output.dat. Write a C++ program statement that would be used ()

35. The following is a C++ program segment. Use it to answer the questions that follows. Class generalObject { Float ,a,b=5; Void Setvalue(); } Identify two errors in the program segment ()

36. Outline a circumstance under which a copy constructor would be used in object oriented programming languages ()

37. Create a union in C++ programming language named employee which contains the following fields: employee identification number, employee name, basic salary, hour worked, rate per hour and rate of taxation ()

38. with aid of a diagram in each case, describe each of the following relationships as used in object-oriented programming language. (2 marks) (I)A-kind-of; II) Is-a ()

39. Write a C++ programs that has: •One static object named number; •Two data functions named num1 and num2 •Two void member functions called show and plus The program should accept num1 and num2 and then increment them by 2 through the plus function. The program should then output the result through the show function ()