OOP IMP Questions for EndSem
OOP IMP Questions for EndSem
1. What does inheritance mean in C++? What are different forms of inheritance? Give an
example of each.
2. What is containment? Explain with the help of String, Date, and Employee class. Objects
of Date and String classes are data members of Employee Class.
3. Explain virtual base class and virtual function with example.
4. Write a C++ program demonstrating use of pure virtual functions with base and derived
classes.
5. What is the ambiguity that arises in multiple inheritance? How can it be overcome?
Explain with example.
6. Discuss the role of access specifiers in inheritance and show their visibility when they are
inherited as public, private, and protected.
7. How do you inherit a base class as protected? Explain it in Multiple base classes.
8. Discuss how inheritance promotes software reuse, saves time during program
development, and helps prevent errors.
9. Explain function overloading and function overriding in detail.
10. What is polymorphism? Explain with example how to achieve runtime polymorphism.
11. Compare late binding and early binding.
12. Write a copy constructor for Employee class, in which objects of string class and Date
class are the data members.
3. Templates, Exception Handling, and Namespaces
1. Explain exception handling mechanism in C++. Write a program in C++ to handle divide
by zero exception.
2. Explain class template and function template with example.
3. Explain class template using multiple parameters. Write a program in C++.
4. Write a C++ program involving a function template.
5. Write a C++ program using function template to find the product of two integer or
floating-point type of data.
6. What is a user-defined exception? Write down scenarios where we require user-defined
exceptions.
7. What is namespace? Demonstrate namespace with example.
8. What is stream? Explain types of streams available in C++.
4. File Handling
1. What is file mode? Explain any four file modes supported by C++.
2. Write a program using the open(), eof(), and getline() functions to open and read file
contents line by line.
3. Explain error handling during file operations.
4. What is the difference between opening a file with constructor function and opening a file
with open() function?
5. Write a program using put() to write characters to a file until user enters a dollar sign.
6. Explain the role of seekg(), seekp(), tellg(), tellp() functions in the process of random
access in a file.
7. Explain manipulators for file handling in C++.
8. What is file pointer? Write a note on file opening and file closing.
9. Explain stream classes hierarchy for file handling in C++.