0% found this document useful (0 votes)
168 views2 pages

Knec Oop

Uploaded by

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

Knec Oop

Uploaded by

raymondkimenju9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

KNEC OOP (NOV 2023)

THEORY

1. Outline 3 types of polymorphism used in object oriented programming


 Compile time
 Run time
 Parametric
2. Describe 2 types of persistent object oriented databases
 Pure Object Oriented Databases

 Pure object-oriented databases store objects directly, without any transformation


or mapping. They maintain the relationships between objects and support features
such as inheritance, polymorphism, and encapsulation.

 Object Relational Databases

 Object-relational databases combine features of both relational databases and


object-oriented databases. While they store data in tables like relational databases,
they also support object-oriented concepts such as inheritance, encapsulation, and
polymorphism.

3. Differentiate between is-a and has-a relationships as applied in OOP


 In is-a relationship it signifies that an object of the subclass "is a" specialized
type of the superclass thus inheritance allows the subclass to inherit
attributes and behaviors (methods) from the superclass, promoting code
reuse and establishing a hierarchical relationship, while has-a relationship It
signifies that an object of one class contains or is composed of objects of
another class. Composition implies a strong relationship where the lifetime of
the contained object is dependent on the lifetime of the container object.
4. Outline three disadvantages of inheritance in Object Oriented Programming
- It can become complex and difficult to understand especially in large
systems.
- It can lead to fragile base class problems.
- It can make it difficult to test classes in isolation.
5. Describe two ways of incorporating comments in a C++ program

 Single-Line Comments (//): Used for brief comments on a single line.


 Multi-Line Comments (/* */): Used for longer comments that may span multiple lines.

6. Describe two circumstances that would necessitate the usage of enumerated data type in C+
+ programs
 Defining a Set of Related Constants: Enums provide a clear and organized way to
define and use related constants, such as days of the week or directions.
 Representing State Machines or Status Codes: Enums help manage different states or
status codes in a readable and maintainable manner, useful in applications like traffic light
control or error handling.
7. Outline three reasons for implementing data encapsulation in OOP
8. Explain two ways of coping emerging trends in OOP
9. Differentiate between unstructured and modular programming paradigms
10. Outline 4 data modifiers that could be used in C++ Programming
11. Differentiate between wild pointer and dangling pointer as used in C++ Programming
12. Outline 4 circumstances under which a complier would reject an inline request in C++
Programming
13. Outline 4 conditions that should be considered when using a static class member in OOP
14. Differentiate between associative containers and container adapters as used in class libraries
15. Outline the function of the header files;
i) Ofstream
ii) Fstream
iii) Ios
16.

You might also like