oop
oop
23124
3 Hours / 70 Marks Seat No.
Marks
P.T.O.
22316 [2]
Marks
2. Attempt any THREE of the following: 12
a) Explain the rules for naming variables in C++. (Any four points)
b) Explain the access specifiers in C++.
c) What is inheritance? Give different types of inheritance.
d) Write a C++ program to find out whether the given number
is even or odd (taking input from keyboard).
Fig. No. 1
b) Describe ‘this’ pointer in C++ with an example.
c) Write a program to declare a class ‘employee’ containing data
members ‘emp-id’ and ‘salary’. Accept and display this data
for 10 employees.
P.T.O.
22316 [2]
Marks
3. Attempt any THREE of the following: 12
a) Write a program to print first n natural numbers and their
sum using for loop.
b) Compare static and non-static data members. (any four points)
c) State any four rules for virtual functions.
d) Write a program for get and put functions.
Marks
b) List c++ stream classes along with their function. (any two
classes)
P.T.O.
22316 [2]
Marks
2. Attempt any THREE of the following. 12
a) State and describe characteristics of object oriented
programming.
b) Write a C++ program to declare a class college with name
and code. Derive a new class as student with members as
name. Accept and display details of one student along with
college data.
c) Write a C++ program to declare a class student with data
members as roll no and name. Declare a constructor to
initialize data members of class. Display the data.
d) Describe concept of type casting using suitable example.
Result
Total
Fig. No. 1.
Accept and display total of one object of result.
c) (Hint : class 1 contains m1 and class 2 contains m2)
Write a C++ program to declare two classes with data
members as m1 and m2 respectively. Use friend function
to calculate average of two (m1, m2) marks and display it.
P.T.O.
22316 [4]
Marks
c) Write a program to implement inheritance as shown in
figure No. 2. Assume suitable member function
Staff
Code
Teacher Officer
Subject Grade
Fig. No. 2.
Accept and display data of one Teacher and one Officer.
22316
11920
3 Hours / 70 Marks Seat No.
P.T.O.
22316 [2]
Marks
2. Attempt any THREE of the following: 12
a) Describe memory allocation for objects.
b) Write a program to implement single inheritance from the
following Refer Figure No. 1.
Fig. No. 1
P.T.O.
22316 [4]
Marks
Fig. No. 2
Marks
P.T.O.
22316 [2]
Marks
2. Attempt any THREE of the following: 12
a) Write a ‘C++’ program to find factorial of given number using
loop.
b) Write a C++ program to declare a class COLLEGE with
members as college code. Derive a new class as STUDENT
with members as studid. Accept and display details of student
along with college for one object of student.
c) Write a C++ program to find smallest number from two numbers
using friend function. (Hint : use two classes).
d) Differentiate between run time and compile time polymorphism.
Class : Result
data mem : Total
Fig. No. 1
Accept and display data for one object of class result.
b) Describe following terms: Inheritance, data abstraction, data
encapsulation, dynamic binding.
c) State and describe visibility modes and its effects used in
inheritance.
d) Write a C++ program to count number of spaces in text file.
e) Differentiate between contractor and destructor.
P.T.O.
22316 [4]
Marks
6. Attempt any TWO of the following: 12
a) (i) Describe structure of C++ program with diagram.
(ii) Write a C++ program to add two 3 × 3 matrices and
display addition.
b) Write a program to swap two integers using call by reference
method.
c) Write a C++ program to implement following in heritance.
Refer Figure No. 2.
Class : Result
Fig. No. 2
Accept and display data for one object of class result (Hint :
use virtual base class).
22316
11819
3 Hours / 70 Marks Seat No.
Marks
P.T.O.
22316 [2]
Marks
f) Give output for following code:
class student
{
int roll no;
char name [14];
} s[6];
void main( )
{
cout <<sizeof(s);
}
g) Write syntax to define a derived class.
Class : Info
Accept and display data of one teacher and one student using
object of class ‘Info’.
b) Write a C++ program to print multiplication table of 7.
(example: 7 × 1 = 7 ..... 7 × 10 = 70)
c) Write a C++ program to swap two integer numbers and swap
two float numbers using function overloading.
(Hint : overload swap function)
d) Write a C++ program to count number of spaces present in
contents of file.
e) Write a C++ program to find greatest number among two
numbers from two different classes using friend function.
P.T.O.
22316 [4]
Marks
6. a) Attempt any TWO of the following: 12
(i) Write a C++ program to find whether the entered number
is even or odd.
(ii) Write a C++ program to declare a structure employee
with members as empid and empname. Accept and
display data for one employee using structure variable.
b) Write a C++ program to implement following inheritance.
Class : Employee
Data : empid
Member : empcode
Accept and display data for one programmer and one manager.
Make display function virtual.
c) Write C++ program for following multilevel inheritance.
Class : Carmanufacturer
datamember : Name
Class : Carmodel
datamember : Model name,
Model no.
Class : Car
datamember : Car no., colour
Accept and display data for one car with all details.