1. Define the main features of OOPs.
The main features of Object-Oriented Programming (OOPs) are:
- **Encapsulation**: Bundling of data and methods into a single unit.
- **Inheritance**: Reusing code from one class to another.
- **Polymorphism**: Same interface, different implementations.
- **Abstraction**: Hiding internal details and showing functionality.
2. Define Object Oriented Programming (OOPs).
Object Oriented Programming (OOPs) is a programming paradigm based on the concept of 'objects', which
contain data and functions. It promotes modularity, reusability, and real-world modeling.
3. List the basic concepts of OOPs.
The fundamental concepts of OOPs are:
- Class
- Object
- Inheritance
- Polymorphism
- Encapsulation
- Abstraction
4. What are access specifiers?
Access specifiers define the access level of class members:
- **Public**: Accessible from anywhere.
- **Private**: Accessible only within the class.
- **Protected**: Accessible in the class and its derived classes.
5. Write different types of data types.
There are three main types of data types:
- **Primitive**: int, float, char, etc.
- **Derived**: arrays, functions, pointers.
- **User-defined**: class, struct, enum, union.
6. What is a static data member?
A static data member is shared among all objects of a class. It is initialized only once and retains its value
across all instances.
7. Define Inheritance.
Inheritance is a feature of OOPs where one class (derived) inherits properties and behaviors from another
class (base).
8. Types of Inheritance.
There are five types of inheritance:
- **Single**
- **Multiple**
- **Multilevel**
- **Hierarchical**
- **Hybrid**
9. Define Polymorphism.
Polymorphism is the ability of a function or object to behave differently in different contexts. It is of two types:
compile-time and run-time.
10. Define function overloading.
Function overloading allows multiple functions to have the same name with different parameters. It is an
example of compile-time polymorphism.
11. Define function overriding.
Function overriding occurs when a derived class redefines a base class method. It supports runtime
polymorphism.
12. Define Constructor.
A constructor is a special method in a class that initializes objects. It has the same name as the class and no
return type.
13. Define Destructor.
A destructor is a special function used to release memory or resources. It has the same name as the class
preceded by a tilde (~).
14. Define Encapsulation.
Encapsulation is the process of wrapping data and code together as a single unit. It helps in data hiding and
access control.
15. Define friend function.
A friend function is a non-member function that can access private and protected members of a class. It is
declared using the 'friend' keyword.
16. Define virtual function.
A virtual function is a member function in a base class that can be overridden in a derived class. It is used for
runtime polymorphism.
17. Define Pointer.
A pointer is a variable that stores the memory address of another variable. It is widely used for dynamic
memory and function referencing.