UT Question Bank OOP-1
UT Question Bank OOP-1
UT Question Bank OOP-1
Class : Info
Accept and display data of one teacher and one student using object of class ‘Info’.
Class : Employee
Data : empid
Member : empcode
Accept and display data for one programmer and one manager. Make display function
virtual.
Class : Carmodel
datamember : Model name,
Model no.
Class : Car
datamember : Car
no., colour
Accept and display data for one car with all details.
Class : Result
data mem : Total
Fig. No. 1
6. State and describe visibility modes and its effects used in inheritance. (4 times)
7. Write a C++ program to implement following in heritance. Refer Figure No. 2.
Class : College
Student student id
Data mem :
College_code
Class : Result
Fig. No. 2
Accept and display data for one object of class result (Hint : use virtual base class)
8. What is multilevel inheritance? Draw the diagram to show multilevel inheritance. using
classes with data member and member function.
9. Write a program to implement the following hierarchy using suitable member
functions. Refer Figure No. 3.
Class: Student
Class: Result
1. With suitable example, describe effect of ++ and – – operators used with pointer in
pointer arithmetic.
2. Describe the concept of virtual base class with suitable example. (2 times)
3. Write a C++ program to swap two integer numbers and swap two float numbers using
function overloading. (Hint : overload swap function)
4. Write a C++ program to overload binary operator ‘+’ to concatenate two strings. (3
times)
5. Give meaning of following statements: int * ptr, a = 5; ptr = & a ; cout << * ptr ; cout
<< (* ptr) + 1;
6. Differentiate between run time and compile time polymorphism. (3 times)
7. Write any four rules of operator overloading.
8. Write a program in C++ to overload unary ‘_’ operator to negate values of data
members of class. (2 times)
9. Explain virtual base class with suitable example.
10. Describe ‘this’ pointer with an example.
11. What are the rules for virtual function?
12. State the need of virtual function in C++.
13. Write a C++ program to overload add function to add two integer numbers and two
float numbers.
14. Define pointer operator and address operator with example.
15. Explain concept of pointer with example.
16. Develop a c++ program to perform arthmatic operation using pointer.
17. Develop a c++ program to implement virtual Base class.
UNIT-5: File Handling