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

This paper is solved and verified by experts and examiners

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. Define each of the following terms as applied in object oriented programming. (4 marks) (i)Object (ii)Variable ()

2. Differentiate between token and identifier as used in programming ()

3. Determine the output of the following C++ statements: (2 marks) char c =’ A’; short m =26; int n= c+m; cout<)

4. with the aid of C++ syntax code explain instance variable ()

5. Johan designed an object-oriented program, the program failed to compile due to incorrect identifier declaration. Explain three rules he should have followed ()

6. Identify the type of error that will be generated in each of the following cases: (i)Division by a variable that contain a variable zero; (ii)Multiplication operator used for division (iii)Missing semicolon ()

7. Explain two types of class access specifiers in C++. ()

8. Write a C++ expression for the following mathematical equation: #(z=x^3+y^3-(xy)/z)# ()

9. Distinguish between Boolean and character literal as used in programming ()

10. Explain three errors handling techniques in C++. ()

11. Outline two advantages of using functions in object oriented programming ()

12. State two differences between static and non-static data members ()

13. The following is a C++ program segment. Use it to answer the questions that follows; String x=’’information’’; String y=’’communication’’; Determine the output generated by each of the following function; (6 marks) (i)Cout<<’’(x+y)’’; (ii)Cout<<’’(x.length())’’; (iii)Cout<<”(x.equals(y))”; ()

14. Define an impure function ()

15. With the aid of syntax code explain how the member function can be accessed using pointers. ()

16. Explain local variable as used in object oriented programming ()

17. Distinguish between encapsulation and abstraction as used in C++. ()

18. With the aid of syntax code explain inline function ()

19. Define the term enumerated data type ()

20. Write a program in C++ that would initialize the values (20 50 40 10 30) into array. The program then display the sum, maximum, and minimum of the values ()

21. Outline four characteristics of constructors as used in object oriented programming ()

22. With the aid of syntax code explain copy constructor ()

23. A C++ class has the name student with the following attributes: Roll number: 5 Total marks: 430 Age: 16 Write a C++ program to declare the class ()

24. The following code was written by a student. Use it to answer the questions that follows. If(hours=40) { Cout<<”full time”; } Else if(hours<40) { Cout<< “part time” } Else { Cout<< “overtime due”; } (i)Identify three bugs in the code (ii)Re-write the code correctly ()

25. Outline three differences between overloading and overriding as used in object oriented programming ()

26. Explain the term compile time polymorphism ()

27. Distinguish between ifstream and ofstream in file operation ()

28. Write a program in C++ to prompt a user to enter a figure (either a circle or rectangle). The program then computes the area of the figure entered through a function and display the result ()

29. Define each of the following terms as used in object oriented programming: (i)Virtual function; (ii)Abstract class. ()

30. Explain the term object slicing as applied in inheritance ()

31. Table 1 shows the criteria used to award bursaries to applicant. Use it to answer the question that follows. Write a program in a C++ that would prompt a user to enter the credit scores of an applicant. The program then output the amount. Use case statement ()

32. Figure 1 shows type of inheritance in C++. Use it to answer the question that follows. (i)Identify the type of inheritance depicted in the figure. (1 marks) (ii)Describe the problem associated with this type of inheritance. (2 marks) ()

33. Explain two types of exceptions in object oriented programming ()

34. Describe namespace as used in C++ programming language ()

35. With the aid of a syntax code, explain the use of break and continue statements ()

36. Write a program in C++ to accept a string through the keyboard and store it in a file ()