Hi, Grade 12 computer science students. Our team from Notesdada has made a collection of a few important long-answer questions and short-answer questions from Object Oriented Programming - OOP.
Class 12 Computer Science Model Questions
OBJECT-ORIENTED PROGRAMMING (OOP)
Long Answer Questions
1. Define the terms Inheritance and Polymorphism.
Inheritance
The concept of classes leads to the idea of inheritance. In our regular lives, we use the idea of classes being divided into subclasses. We know that a class of animals can be divided into mammals' amphibians, insects, and reptiles. A class of vehicles is divided into cars, trucks, buses, and motorcycles.
The principle in this sort of division is that each subclass shares common properties with the class from which it is derived. For example, all of the cars in a class may share similar properties of having wheels and a motor. Thus, "Inheritance is the property that allows the reuse of an existing class to build a new class".
Polymorphism
The word polymorphism is derived from the Latin words; i.e. 'poly' means 'many' and 'morphos' means 'forms'. Thus 'polymorphism' means 'having many forms'. Object-oriented programming languages try to make existing code easily modifiable without actually changing the code. Polymorphism means that the same functions may behave differently in different classes. Thus, "Polymorphism enables the same function to behave differently on different classes".
Short Answer Questions
1. Define the terms class and object.
Object
An object is a self-contained component that accommodates properties and methods needed to make a certain type of data useful. An object's properties are what it knows and its methods are what it can do. Objects are the fundamental building blocks of applications from an object-oriented point of view. An object consists of data and functions, functions are used to perform the operations on data.
Class
A class is a collection or group of similar objects that have some properties, common behavior, and relationships. Objects with the same kind of properties and actions need to be grouped together into a unit that can be used in a program. Each class describes a set of individual objects. Each class should be designed and programmed to accomplish a task. Example of class: class of a person, class of animals, etc.
2. What is the importance of OOP?
Importance of OOP
OOP (Object Oriented Programming) is a programming model that uses "object" to create applications and computer programs.
OOP (Object Oriented Programming) is important in program designing because of:
- Simplification of the program.
- Need for secured programs.
- The inheritance concept can be used to get rid of the redundant code.
- The message-passing concept helps the programmer communicate between different objects.
- With the help of the inheritance concept, we can define different classes with combined features.
- New data and functions can be easily coded whenever necessary.
- OOP treats data as a critical element and forbids it to flow freely around the program.
- OOP ties data elements intimately to the functions that operate.
3. What is OOP? Write the application of OOP.
OOP
OOP (Object Oriented Programming) is a programming model that uses "Object" to create software and computer programs. It is a collection of cooperative objects, and each object is capable of receiving messages, processing data, and sending messages to the other objects.
The fundamental idea behind OOP is to combine data and functions into a single unit i.e. objects which transmit with each other by calling one another's member functions.
Application of OOP
- Different applications of OOP are:
- AI (Artificial Intelligence) based system Expert system
- DSS (Decision Support System).
- OAS (Office Automation System)
- Neural Network
- CAD/CAM
- Real-time systems
- Object-oriented database
- Simulation and modeling
- Hypertext and Hypermedia
4. What is OOP? List the characteristics of OOP.
OOP
OOP (Object Oriented Programming) is a programming template that uses "object" to create applications and computer programs. It is a collection of cooperative objects, and each object is capable of receiving messages, processing data, and sending messages to the other objects.
The fundamental idea behind OOP is to combine data and functions into a single unit i.e. objects that transmit with each other by calling one another's member functions.
Characteristics of Objects-Oriented Programming
The characteristics of OOP are:
- Class: Basic building blocks OOP and a single entity that has data and operations on data together.
- Object: The instances of a class that are used in practicality - its variables and operations.
- Data Abstraction: Specifying what to do but not how to do it. It is a flexible feature for having an overall view of an object's functionality.
- Encapsulation: Binding data and operations of data with each other in a single unit.
- Inheritance: Reusability and extension of existing classes.
- Polymorphism: Multiple definitions for a single name. Functions with the same name with different functionalities.
- Message passing: Objects interface through invoking technique and sending data to them. This feature of sending and receiving data among objects through a function framework is known as Message Passing.