0% found this document useful (0 votes)
4 views2 pages

Python OOP: Classes, Inheritance, and Methods

The document outlines an advanced programming assignment focused on object-oriented concepts in Python, including class creation, operator overloading, inheritance, and method overriding. It consists of ten questions that require the implementation of various classes and functionalities such as matrix operations, account management, appliance power usage, and a library management system. Additionally, it covers advanced topics like deep and shallow copying, error handling, and a plugin system using inheritance.

Uploaded by

kadamguru198
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)
4 views2 pages

Python OOP: Classes, Inheritance, and Methods

The document outlines an advanced programming assignment focused on object-oriented concepts in Python, including class creation, operator overloading, inheritance, and method overriding. It consists of ten questions that require the implementation of various classes and functionalities such as matrix operations, account management, appliance power usage, and a library management system. Additionally, it covers advanced topics like deep and shallow copying, error handling, and a plugin system using inheritance.

Uploaded by

kadamguru198
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

Advanced Assignment: Class, Object, Constructor, and Inheritance

Q1: Create a class 'Matrix' to represent a 2D matrix. Implement methods to add,

subtract, and multiply two matrices. Overload the operators (+, -, *) for these

operations.

Q2: Create a class 'Account' with methods for creating a new account and

maintaining transaction logs. Use a static variable to keep track of the total

number of accounts created.

Q3: Define an abstract base class 'Appliance' with an abstract method

'power_usage'. Derive classes 'WashingMachine' and 'Refrigerator', and

implement the 'power_usage' method in both. Use the ABC module.

Q4: Write a program to demonstrate method overriding and method overloading

in a class hierarchy. Create a base class 'Shape' and derived classes 'Triangle'

and 'Square'.

Q5: Implement a deep and shallow copy of an object using the copy module.

Demonstrate the difference with a class 'Employee' containing a nested

'Address' object.

Q6: Create a class hierarchy to represent a library management system with

classes for 'Library', 'Book', and 'Member'. Add features for borrowing,

returning, and tracking books.

Q7: Define a class 'Robot' with attributes for its position on a 2D grid.

Implement methods to move the robot in different directions and track its path.

Add error handling for invalid movements.

Q8: Write a program to demonstrate the diamond problem in multiple

inheritance and solve it using Python's MRO (Method Resolution Order).

Q9: Create a class 'DataPipeline' with methods for data processing (e.g.,

filtering, transformation). Use method chaining to allow multiple operations in a


single statement.

Q10: Implement a plugin system using Python's inheritance. Create a base

class 'Plugin' and allow users to dynamically add new functionality by

inheriting from this class.

You might also like