Object Oriented Programming Using C++'
Object Oriented Programming Using C++'
Object Oriented Programming Using C++'
Chapter 1
6) Describe following terms: Inheritance, data abstraction, data encapsulation, dynamic binding
12) Write a C++ program to accept array of five elements, find and display smallest number from an
array.
13) With suitable diagram describe structure of C++ program.
14) Write a C++ program to print multiplication table of 7.(example: 7 × 1 = 7 ..... 7 × 10 = 70)
15) a.Write a C++ program to find whether the entered number is even or odd.
b.Write a C++ program to declare a structure employee with members as empid and emp name.
Accept and display data for one employee using structure variable.
Chapter2
9) Write a C++ program to find smallest number from two numbers using friend function. (Hint : use two
classes).
10)Write a C++ program to create a class STUDENT The data members of STUDENT class.
Roll_No
Name
Marks
Accept data for five students and display it. Write a C++ program to displya sum of array elements of
array size n:
11) Describe how memory is allocated to objects of class with suitable diagram.
13) Write a C++ program to declare a class student with members as roll no, name and department.
Declare a parameterised constructor with default value for department as ‘CO’ to initialize members of
object. Initialize and display data for two students.
15) Write a program to declare a class ‘student’ having data members as ‘stud_name’ and ‘roll_no’.
Accept and display this data for 5 students.
16) Write a C++ program to declare a class ‘circle’ with data members as radius and area. Declare a
function getdata to accept radius and putdata to calculate and display area of circle.
17)Write a C++ program to declare a class addition with data members as x and y. Initialize value of x and
y with constructor. Calculate addition and display it using function ‘display.’
18) Write a C++ program to find greatest number among two numbers from two different classes using
friend function.
19) Write a C++ program to declare a class ‘Account’ with data members as accno, name and bal. Accept
data for eight accounts and display details of accounts having balance less than 10,000.
Chapter3
6)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.
7) What is multilevel inheritance? Draw the diagram to showmultilevel inheritance. using classes with
data member and member function.
Class : Result
College_code
Class : test
Class : sports
data mem : percentage
Class : Result
Accept and display data for one object of class result (Hint : use virtual base class).
13)Write a program to implement the following hierarchy using suitable member functions.
Class :student
member: roll_no,name
class:sports
member :score
Class : Teacher
Class : Student datamember :
datamember : Name sname rollno.
empid
Class : Info
Accept and display data of one teacher and one student using object of class ‘Info’.
17) Write a C++ program to implement following inheritance.
Accept and display data for one programmer and one manager. Make display function virtual.
Chapter4
1) Give meaning of following statements:
int * ptr, a = 5;
ptr = & a ;
cout << * ptr ;
cout << ( * ptr) + 1;
7) Write a program to declare a class ‘book’ containing data members as ‘title’, ‘author-name’,
‘publication’, ‘price’. Accept and display the information for one object using pointer to that object.
8)With suitable example, describe effect of ++ and – – operators used with pointer in pointer arithmetic.
Write a C++ program to swap two integer numbers and swap two float numbers using function
overloading. (Hint : overload swap function)
7)Write a C++ program to overload binary operator ‘+’ to concatenate two strings.
Chapter5
4) Write a C++ program to append data from abc . txt to xyz . txt file.
8) Write a C++ program to write ‘Welcome to poly’ in a file.Then read the data from file and display it on
screen.