Click to follow our Afritutor YouTube Channel, subscribe and click notifications and get updates on new learning videos


<=Back

<=KNEC Diploma in ICT module 2 Object Oriented Programming past paper: November 2013

State three uses of a friend class in object oriented programming

    Viewed:  612  times
For Better experience and learning,for video answers, after video ends playing, click next question in the questions list!!!

  Share in:
        

Question Answer:





Questions List:

1. List four examples of object oriented programming languages other than C++.
2. Explain the term unstructured programming
3. write an if control structure statements equivalent to the following C++ program statement x = (a>b) ? a:b;
4. Explain a circumstance under which each of the following access specifier would be used in a C++ program: I. private; II. protected.
5. Differentiate between hybrid object oriented databases and pure object oriented databases
6. Write a C++ program that would define a class named power with the following properties: Data member: •product Member function: •power; •calculate_power. (using for loop control structure) The program should then accept two integer values (x and y) and determine the value of xy through the use of the member function calculate power. The program should then output the results
7. Explain each of the following terms as used in object oriented programming languages (i)Abstraction; (ii)SizeOf
8. Differentiate between keyword and identifier as used in object oriented programming language
9. Write a C++ programs that accepts 20 characters from the computer keyboard and the program should store the characters in a text file.
10. Write a C++ program that accepts interior dimensions in meters of a cubical tank. The program should then calculate and output: (i)The interior surface area; (ii) The quantity of paint required for the interior surface area given that 1 liter cover 2 square meters
11. Outline three characteristics of static data member as used in object oriented programming
12. Explain three uses of nested class as used in object oriented programming language.
13. Describe a virtual class as used in object oriented programming language
14. State two properties of static member function as used in C++ programming
15. Explain the purpose of getline() as used in C++ programs
16. State two reasons that justify the use of files in C++ programs
17. Differentiate between binary and unary operator overloading as used in object oriented programming languages.
18. Differentiate between binary and unary operator overloading as used in object oriented programming languages.
19. Figure 1 shows categorized data types as used in C++ programs. Use it to answer the questions that follows. List two examples for each of the categories
20. Given that a=4 and b=6, determine the value of a|b.
21. Write the general syntax for operator overloading
22. State reasons for the use of operator overloading
23. State three uses of a friend class in object oriented programming
24. Explain the term virtual function as used in object oriented programming language
25. Explain a circumstance under which each of the following operator can be overloaded: I. [ ]; II. (); III. >>
26. Differentiate between a compound assignment operator and a relational operator.
27. interpret each of the following C++ program statements; (i) b=(int) a; (ii) int b(int a);
28. write the syntax for defining a destructor in a C++ program
29. Figure 2 shows a class inheritance. Use it to answer the question that follows. Write a C++ program that would implement the classes named teacher and person. The program should then accept the name ,age, basic salary, house allowance, rate of taxation and calculate the net salary through the Compute_netsal(). The program should then output the net salary. Hint: tax=basic salary*rate
30. Outline two purpose of a free store in programming
31. Explain each of the following terms as used in object oriented programming language. (i) Runtime polymorphism; (ii) Pure virtual function.
32. Differentiate between windows based and a command based operating system
33. Class C is a derived class of class B, class B is a derived class of class A. class C and B are the base classes of class D. I.Represent this inheritance in a diagram II. Write a C++ program syntax to represent this classes
34. Explain a circumstance under which a friend function can be used to overload an operator.
35. Figure 3 shows the dimension of a ring. Use it to answer the questions that follows. Write a C++ program that accepts the values r1 and r2 and calculate the area of the shaded part through the use of inline function. The program should the output the shaded area. (5 marks) Hint: area of a circle=pie*Radius*Radius.
36. Define the term coercion polymorphism as applied in OOP
37. Use the following C++ program segment to answer the questions that follows: float radius=7.0; int area; float pie=3.14; area= pie*radius*radius. Compute the value of the area
38. Explain each of the following terms as used in object oriented programming: (4 marks) (i) static resolution (ii) virtual destructor
39. Object oriented programming language has both classes and structures. Justify the existence of each of these two in this language.
40. State the output from the following C++ program. (2 marks) #include<iostream.h> int a=10; int main() { int m=20; int b=a; int a=5; cout<< “B =”<
41. Given that a=2, b=25, c=8 and d=5, evaluate each of the following C++ program equations. (6 marks) I. y=(y=a,y*2); II. x= (a*sqrt(b)*d%a)-(c/a+(a*b/d)); III. z=(4/a+c/2*(c+d)*b);
42. The following is a C++ program segment. Use it to answer the question that follows float num1=8.3; int num2=10; double num3=2.4; int result = (int)num1+(int) num2 +(int) num3; Calculate the value of the result.
43. Define the term public inheritance as used in OOP
44. Explain two reasons that justify data hiding in object oriented programming
45. With an aid of a example, explain the term message passing as used in object oriented programming language
46. Explain one reason that justify the use of typedef specifier in C++ programming
47. List four characteristics of constructor as used in OOP
48. Write a C++ program that declares the following data structure: enum Object { Square, Cube, Sphere }; The program should prompt the user to enter the object index, using the switch control structure, the program should then calculate and output the area of the square and the volume of the cube and sphere.


About Us

Contact us

Terms of use | Privacy policy

Follow Us:               

All Rights Reserved © 2024; pscustudies.com