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

OOP IMP Questions for EndSem

The document is a question bank focused on Object Oriented Programming (OOP) concepts, covering topics such as operator overloading, inheritance, polymorphism, templates, exception handling, namespaces, and file handling in C++. It includes specific questions and programming tasks related to each topic, such as overloading operators, demonstrating inheritance, and handling exceptions. The document serves as a comprehensive guide for understanding and applying OOP principles in C++.

Uploaded by

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

OOP IMP Questions for EndSem

The document is a question bank focused on Object Oriented Programming (OOP) concepts, covering topics such as operator overloading, inheritance, polymorphism, templates, exception handling, namespaces, and file handling in C++. It includes specific questions and programming tasks related to each topic, such as overloading operators, demonstrating inheritance, and handling exceptions. The document serves as a comprehensive guide for understanding and applying OOP principles in C++.

Uploaded by

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

Object Oriented Programming (OOP) Question Bank

1. Operator Overloading and Friend Functions

1. What is operator overloading? Why is it necessary to overload an operator?


2. What are the rules for overloading operators?
3. Which operators cannot be overloaded?
4. Write steps to overload + operator so that it can add two complex numbers.
5. Write steps to overload << and >> operators.
6. Give a programming example that overloads == operator with its use.
7. Write a program to overload unary operators.
8. What is a friend function? What are the merits and demerits of using friend functions?
9. Write a program in C++ to demonstrate friend functions.
10. Write a program in C++ to use scope resolution operator.
11. Differentiate friend function with normal function of the class.
12. Write a C++ program for copy constructor for string class.

2. Inheritance and Polymorphism

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++.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy