PYQ OF OOP Unit 3&4

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

PYQ OF OOP

UNIT 3
1) Differentiate between compile time polymorphism and run
time polymorphism.
2) How do you declare and define a pure virtual function in C++?
Explain with help of a program.
3) Write a C++ program for unary increment (++) and decrement
(--) operator overloading.
4) What is operator overloading and why it is useful? Which
Operators cannot be overloaded.
5) How virtual functions are implemented in C++? Explain with
help of a program.
6) Write a program to binary (+) and binary (-) operator in C++.
7) Explain the polymorphism feature of OOP. What are the
different ways to achieve polymorphism in C++ Language?
Explain them along with examples.
8) What is operator overloading? Write a program to overload '+'
operator for adding two complex numbers which are object of
below complex class.
Class Complex
{
Private: int real, imag;
};
9) What is Pure virtual function? Illustrate the use of Pure virtual
function.
10) What is runtime polymorphism? How it is achieved in C++.
Explain it along with example.
11) What is function overloading? Write defination of three
overloaded functions (add) which will add two integer, float and
double numbers respectively.
12) Explain abstract class concept along with example.
13) What is operator overloading? Why it is necessary To
overload an operator?
14) Write a program in C++ to use scope resolution operator.
15) What is friend function? What are the merits & demerits
of using the friend function?
16) What are the rules for over loading operators.
17) Which operators can not be overloaded? Write steps to
overload + operator so that it can add two complex numbers.
18) Write down program to overload unary operators? (Any
three operators).
19)
Unit 4
1) Explain the use of command line arguments. If we want to pass
command line arguments what will be prototype of main
function and explain its arguments along with example.
2) Explain the following file handling functions (solve any three),
i) seekg ( )
ii) tellg ( )
iii) seekp ( )
iv) tellp ( )
3)Write a program Using the C++ file input and output class with
open(), get(), put(),close() methods for opening, reading from and
writing to a file. Use append mode while opening the file for writing.
4)List and Explain different Mode bits used in open () function, while
opening a file. (Any five).
5 Define a class Person that has three attributes viz name, gender
and age. Write a C++ Program that writes an object to a file and reads
an object from a file.
6 Explain what is fstream, ifstream and ofstream with help of
example? Provide the hierarchy of stream classes in C++
7 What are various functions used to manipulate file pointers?
Explain using example.
8 What are command line arguments in C++? Write a program to
explain the same.
9 What are fstream, ifstream and ofstream? Illustrate with help
of example.
10 Write a program to create file, read and write record into it.
Every record contains employee name, id and salary. Store and
retrieve atleast 3 data.
11 What do you mean by file handling? Explain the following
functions.
i) open()
ii) get()
iii) Getline()
12 open() get() getline() Write a program to create files using
constructor function
13 Explain virtual base class & virtual function with example?
14 What does inheritance mean in C++? What are different forms
of inheritance? Give example of each.
15 Discuss the ways in which inheritance promotes software
reuse, saves time during program development and helps
prevent errors.
16 What is the ambiguity that arises in multiple inheritance? How
it can be overcome. Explain with example.
17 What are types of inheritance? Explain in detail.
18 Discuss the role of access specifiers in inheritance and show
their visibility when they are inherited as public, private
protected.

You might also like