C++ Ques

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Subject – Object-Oriented Programming Using C++

1. What is an object and class?


2. Define inheritance and polymorphism.
3. What is meant by implicit and explicit constructors?
4. Define the inline function with an example.
5. Explain method/function overloading with example.
6. What do you mean by exception handling?
7. Difference between static data member and static member functions.
8. Difference between object-oriented programming and procedure-oriented programming.
9. What are the differences between pointers to constants and constant pointers?
10. Define operator overloading. Explain how to overload unary operator and binary operator
with examples.
11. What is Try, Catch and Throw? Explain with an example.
12. What is exception handling? Explain types of exception handling and explain suitable
examples.

1. Explain Catching Exceptions with an example.


2. Explain Static class members with examples.
3. What is a Friend class, explain with an example.
4. Explain File streams in C++.
5. Explain the Stream classes hierarchy with an example.
6. Explain operator overloading in C++ with an example.
7. Define the Base and Derived classes with examples.
8. Differentiate between Structures and classes. Give an example of each.
9. Compare and contrast the variables and constants in C++. What are the rules to be followed
for identifiers?
10. Explain the various types of access specifiers (public, protected, and private) that are used in
C++.
11. Explain multiple catch handlers and write example code.
12. What is a Constructor? Explain types of constructors with examples.
13. Explain the following concerning C++ with examples. 1)new operator 2) destructor
14. What does inheritance mean in C++? What are the different forms of inheritance? Give an
example of each.
15. Explain Public Inheritance, Private Inheritance, and Protected Inheritance with Example.
16. Write a C++ program demonstrating the use of the pure virtual function with the use of base
and derived classes.
Practical Oriented Questions:

1. Create a class Student with ID, marks for 3 subjects, total as instance variables, instance
method to compute the total, and main method to print the student information. Modularize
the code to class and package/namespace levels.
2. Write a C++ Program to read details of a student from a file and copy them to the other.
3. Write a C++ Program to store details of 10 students in an array of Student references and print
them. Develop code with a method in MyFirstClass a) factorial () that computes the factorial
of a given number.

Design a class named QuadraticEquation for a quadratic equation ax2 + bx + c = 0. The class contains:
a) Attributes a, b, and c that represent three coefficients. b) Three getter methods for a, b, and c. c)
A method named getDiscriminant() that returns the discriminant, which is b2 - 4ac. d) The methods
named getRoot1() and getRoot2() for returning two roots of the equation.

You might also like