Department of Computer Science and Engineering 13.507 Object Oriented Programming Lab Lab Cycle
Department of Computer Science and Engineering 13.507 Object Oriented Programming Lab Lab Cycle
ENGINEERING
13.507 OBJECT ORIENTED PROGRAMMING LAB
LAB CYCLE
SL NO:
1
2
3
4
5
6
7
8
9
10
11
12
13
EXERCISES
Introduction to C++ programs
Familiarization of dynamic memory allocation
Implementation of function overloading
Implementation of programs using classes and objects
Understanding the concept of static data members
Implementation of programs using friend functions
Implementation of programs using the concept of friend classes
Implementation of operator overloading
Implementation of inheritance in programs
Understanding the concepts of constructors and destructors
Implementation of programs involving abstract base classes
File handling techniques
Template handling
QUESTIONS
1. Introduction to C++ programs
a. Write a C++ program to swap the values of two variables using call by value
and call by reference.
b. Writ a program to create a binary tree to perform inorder, preorder, postorder
traversals.
2. Familiarization of dynamic memory allocation
a. Write a program that uses new and delete operators for dynamic allocation
and deallocation of memory.
3. Implementation of function overloading
a. Write a C++ program to find volume of cone, cube, and sphere using
function overloading.
4. Implementation of programs using classes and objects
a. Design a class to represent a bank account, include the following DATA MEMBERS:
name of depositor, account no, type of account and balance amount in the account &
MEMBER FUNCTIONS: to assign data values, to deposit an amount, to withdraw an
amount after checking balance, and a function to display name and balance. Write a main
program to test the program.
b. Write a program using concept of classes to read details of students with marks of three
subjects and find its total. Also write the functions to insert new details like student
details and display.
5. Understanding the concept of static data members
a. Write a C++ program to count the number of objects created in the class.
6. Implementation of programs using friend functions
a. Create two classes DM and OB to store the value of distances. DM stores distance in
metres and centimeters and DB in feet and inches. Write a program that can read value
for class objects and add one object of DM with other object of DB. Use a friend function
to carry out the addition operation.