0% found this document useful (0 votes)
2 views3 pages

Object Oriented Programming Lab Questions

The document contains a list of 24 lab questions related to Object Oriented Programming, covering various concepts such as class creation, inheritance, operator overloading, function overloading, and file handling. Each question requires the implementation of specific classes and functionalities, including member functions, constructors, destructors, and exception handling. The questions aim to enhance understanding of OOP principles through practical coding exercises.

Uploaded by

arsalanr708
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Object Oriented Programming Lab Questions

The document contains a list of 24 lab questions related to Object Oriented Programming, covering various concepts such as class creation, inheritance, operator overloading, function overloading, and file handling. Each question requires the implementation of specific classes and functionalities, including member functions, constructors, destructors, and exception handling. The questions aim to enhance understanding of OOP principles through practical coding exercises.

Uploaded by

arsalanr708
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Object Oriented Programming Lab Questions:

1. Write a program to define a class Student with data members: name, roll, and marks.
Use member functions to input and display the data.

2. Create a class Book with a parameterized constructor and a destructor. Demonstrate


their execution.

3. Define a base class Employee with data members like name and salary. Derive a
class Manager that adds department. Input and display all details.

4. Demonstrate function overloading using a class Calculator with multiple add()


methods that accept different types and number of parameters.

5. Create a base class Shape with a virtual function display(). Override it in derived
classes Circle and Rectangle.

6. Create a class Account with private data members. Use public getter and setter
methods to access them.

7. Overload the + operator in a Complex class to add two complex numbers.

8. Create two classes Alpha and Beta. Write a friend function to access and display
private data from both.

9. Create an abstract class Vehicle with a pure virtual function start(). Derive Car and
Bike classes that implement start().

10. Define a class Student. Write and read its object data to/from a file using ofstream
and ifstream.

11. Create a base class Person with basic details like name and age. Derive a class
Employee from Person, adding employeeID and salary. Further derive a class
Manager that adds department. Input and display all details.

12. Create two base classes Academic and Sports having academic and sports scores
respectively. Derive a class Result that calculates and displays the total score.
13. Use a combination of multiple and multilevel inheritance to design a class structure
for a StudentResult that includes Student, Test, and Sports classes.

14. Create a class Counter with a static data member to count how many objects have
been created. Use a static function to display the count.

15. Create a class Box with length, width, and height. Use a copy constructor to create
a duplicate object and display both.

16. Create a class String that uses dynamic memory allocation to store strings. Include
constructors and a destructor to manage memory.

17. Create a class Rectangle with member functions to set dimensions and calculate
area. Use the this pointer to return the current object for method chaining.

18. Write a class template Calculator that performs basic operations (add, subtract) for
different data types like int, float, etc.

19. Create a class Division with a function to divide two numbers. Handle divide-by-zero
exceptions using try-catch blocks.

20. Create a class MathOperations that includes inline functions for multiplication and
division, using default arguments.

21. Design a class BankAccount with data members like accountNumber, holderName,
and balance. Include member functions to:

Create an account
Deposit amount
Withdraw amount
Display account details

Use a menu-driven program to allow the user to perform these operations. Add basic
validation like insufficient balance.

22. Create a class Student with data members for name, roll number, and marks in 3
subjects. Include member functions to:

Input student data


Calculate total and average
Display data for each student

Use an array of objects to manage records for multiple students.

23. Create a class LibraryBook with members: bookID, title, author, and availability.
Allow the user to:

Add book records


Display all records
Search for a book by ID
Modify availability (issue/return)
Use file handling to store and retrieve data persistently.

24. Design a class Item to represent products in inventory. Include:

Data members: itemCode, itemName, quantity, price


Constructor overloading (default and parameterized)
Function to calculate total price
Function to display item details

Use an array of objects to store multiple items and display a full inventory.

You might also like