Oops Previous Year Sawal
Oops Previous Year Sawal
7. Write a program to exchange values between two classes using friend classes.
Section-B
Note: Attempt any three questions. Each question carries 15 marks.
1. (a) What is a class in programming, and how is it used to create objects? Give an
example of how a class can be used to represent a car, with data members for
model, and year, and methods for accelerating and braking.
(b) Give an example of how polymorphism can be used to create a function that
can take multiple types of objects as input.
2. Write a C++ program that reads in a list of integers from the user, and print out
the maximum and minimum values in the list. The program should use a loop to
read in each integer, and should use variables to keep track of the maximum and
minimum values seen so far.
3. (a) Explain Inheritance & its types in detail. Give an example of how inheritance
can be used to create a subclass from a base class.
(b) Explain with example the various types of access specifiers that are used in
C++.
4. (a) Distinguish between call by value and call by address with proper examples.
(b) Write a program for overloading addition operator.
EXAMINATION 2023-24
OBJECT ORIENTED PROGRAMMING USING C++
Note:
(i) Attempt any five questions from Section A and any three questions from Section
B.
(ii) Answer each question of Section A within 50 words.
(iii) Limit your answers within the given answer book. Additional answer book (B-
answer book) should not be provided or used.
Section - A
Note: Attempt any five questions. Each question carries 5 marks.
2. Differentiate between call by value and call by reference in C++ with suitable
example.
3. Explain with proper syntax the Static data members and member functions used
in C++.
6. What is the difference between opening a file with constructor function and
opening a file with open () function.
7. Write a program in C++ that display entered string into reverse order.
Section - B
Note: Attempt any three questions. Each question carries 15 marks.