Object Oriented Programming (OOP) -
Topicwise PYQ Questions
1. Basics of OOP & Principles
• What is Object Oriented Programming? How is it different from Procedural
Programming?
• Explain the basic concepts of OOP: Class, Object, Inheritance, Polymorphism,
Encapsulation, Abstraction.
• Write a short note on Encapsulation and Data Abstraction.
• Define class and object with a real-life example.
• Compare procedural programming and OOP.
• Write down the features of object-oriented programming.
2. Classes & Objects
• Explain how classes and objects are created in C++.
• How can data be made private in a class?
• What is a constructor? How is it different from a method?
• What is a copy constructor? Explain with an example.
• Differentiate between constructor and destructor.
• Explain the use of the `this` pointer with an example.
3. Inheritance
• What is inheritance? Describe types of inheritance in C++.
• Explain single, multiple, and multilevel inheritance with syntax.
• Write a program to demonstrate multiple inheritance.
• What is ambiguity in multiple inheritance? How is it resolved?
• How can we achieve reusability in OOP? Explain with inheritance.
4. Polymorphism
• What is polymorphism? Differentiate between compile-time and run-time
polymorphism.
• What is function overloading? Give an example.
• What is operator overloading? How is it implemented in C++?
• Explain virtual functions and their importance in OOP.
• What is function overriding? Explain with an example.
5. Abstraction & Encapsulation
• What is abstraction? How is it achieved in C++?
• What is encapsulation? How does it protect data?
• Distinguish between abstraction and encapsulation.
6. Constructors and Destructors
• What are the types of constructors in C++? Explain with examples.
• Explain default constructor and parameterized constructor with examples.
• What is a destructor? When is it called?
• Explain constructor overloading.
7. Friend Functions & Static Members
• What is a friend function? Why and how is it used?
• Explain static data members and static member functions with an example.
8. File Handling & Streams
• What is file handling in C++? Explain file open, read, and write operations.
• What are the different modes in file handling in C++?
• Write a program to count characters in a file.
9. Templates & Exception Handling
• What is a class template? How is it defined and used?
• Differentiate between function template and class template.
• What is exception handling? Explain `try`, `catch`, and `throw` keywords.
• Write a program that demonstrates exception handling in C++.
10. Operator Overloading
• What is operator overloading? How can it be implemented in C++?
• Write a program to overload the `+` operator.
• Explain overloading unary and binary operators.
11. Virtual Functions & Inheritance
• What are virtual functions? How do they support run-time polymorphism?
• What is pure virtual function? Explain with an example.
• Explain abstract classes and their use in C++.