0% found this document useful (0 votes)
11 views5 pages

Practical 9

The document contains 5 questions about classes and objects in Python. It asks the student to create classes for students with details like name, ID, and marks, create objects and display details. It also asks to add methods like calculating percentage and displaying results. Further questions involve implementing inheritance like single, multiple, hierarchical and multilevel inheritance. It also asks to create classes to demonstrate method overriding and operator overloading by adding two point objects.

Uploaded by

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

Practical 9

The document contains 5 questions about classes and objects in Python. It asks the student to create classes for students with details like name, ID, and marks, create objects and display details. It also asks to add methods like calculating percentage and displaying results. Further questions involve implementing inheritance like single, multiple, hierarchical and multilevel inheritance. It also asks to create classes to demonstrate method overriding and operator overloading by adding two point objects.

Uploaded by

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

PRACTICAL NUMBER- 9

Aakash Dagar500107152
Batch-12

AIM:
Classes and Objects

Q1.
Create a class of student (name, sap id, marks (phy, chem, maths)). Create 3 objects by taking
inputs from the user and display details of all students.

Answer:

Q2.
Add constructor in the above class to initialize student details of n students and implement
following methods-
a) Display() student details
b) Find marks_percentage() of each student
c) Display result() Note: If marks in each subject>40% then pass else fail. Write a
function to find average of the class.

Answer:
Q3.
Create programs to implement different types of inheritances.
a) Single inheritance
b) Multiple inheritance
c) Hierarchical inheritance
d) Multilevel inheritance

Answer:

Q4.
Create a class to implement method overriding.
Answer:

Q5.
Create a class for operator overloading which adds two point objects where point has x and y
values.
For example-
If P1 (x=10, y=20), p2 (x=12, y=15) then P3=P1+P2->P3 (x=22, y=35)

Answer:

You might also like