0% found this document useful (0 votes)
15 views

OOP Practical Questions

The document outlines practical questions related to Object-Oriented Programming (OOP) concepts, including class creation, inheritance, and method overriding. It provides specific tasks such as creating vehicle classes with subclasses for cars and bikes, shape classes with a hierarchy, and animal classes demonstrating multiple inheritance. Additionally, it includes a task for managing fruit counts in a basket using class structures.

Uploaded by

wehustle.18
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)
15 views

OOP Practical Questions

The document outlines practical questions related to Object-Oriented Programming (OOP) concepts, including class creation, inheritance, and method overriding. It provides specific tasks such as creating vehicle classes with subclasses for cars and bikes, shape classes with a hierarchy, and animal classes demonstrating multiple inheritance. Additionally, it includes a task for managing fruit counts in a basket using class structures.

Uploaded by

wehustle.18
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/ 1

OOP Practical Questions

[1].We want to store the information of different vehicles. Create a class named Vehicle with
two data member named mileage and price. Create its two subclasses
* Car with data members to store ownership cost, warranty (by years), seating capacity
and fuel type (diesel or petrol).
* Bike with data members to store the number of cylinders, number of gears, cooling
type(air, liquid or oil), wheel type(alloys or spokes) and fuel tank size(in inches). Make
another two subclasses Audi and Ford of Car, each having a data member to store the
model type. Next, make two subclasses Bajaj and TVS, each having a data member to
store the make-type.
Now, store and print the information of an Audi and a Ford car (i.e. model type,
ownership cost, warranty, seating capacity, fuel type, mileage and price.) Do the same for
a Bajaj and a TVS bike.

[2].Create a class named Shape with a function that prints "This is a shape". Create another
class named Polygon inheriting the Shape class with the same function that prints
"Polygon is a shape". Create two other classes named Rectangle and Triangle having the
same function which prints "Rectangle is a polygon" and "Triangle is a polygon"
respectively. Again, make another class named Square having the same function which
prints "Square is a rectangle". Now, try calling the function by the object of each of these
classes.

[3].Create two classes named Mammals and MarineAnimals. Create another class named
BlueWhale which inherits both the above classes. Now, create a function in each of these
classes which prints "I am mammal", "I am a marine animal" and "I belong to both the
categories: Mammals as well as Marine Animals" respectively. Now, create an object for
each of the above class and try calling
1- function of Mammals by the object of Mammal
2- function of MarineAnimal by the object of MarineAnimal
3- function of BlueWhale by the object of BlueWhale
4- function of each of its parent by the object of BlueWhale

[4].Make a class named Fruit with a data member to calculate the number of fruits in a
basket. Create two other class named Apples and Mangoes to calculate the number of
apples and mangoes in the basket. Print the number of fruits of each type and the total
number of fruits in the basket.

You might also like