Python Module 5 and 4
Python Module 5 and 4
Module 5
1. What is class? How to define class in Python? How to initiate a class and
how the class members are accessed?
2. Briefly explain the printing of objects with an example.
3. Explain __init__() and __str__() method with examples.
4. Explain pure function and modifier function with example
5. Define pure function. Illustrate with an example Python program.
6. Explain the concept of copying using copy module with an example.
7. Define operator overloading. Explain the operator overloading to perform
addition of two objects in Python.
8. Define a class and object, construct the class called rectangle and initialise
it with height=100, width=200, starting point as (x=0,y=0). Write a program
to display the centre point co-ordinates of the rectangle.
9. Write a program to implement the following object diagram and its
functionalities as shown in the fig. Initialize the attributes through a
constructor and print the same.
10. Define a function which takes two objects representing complex numbers
and return new complex number with a addition of two complex numbers.
Define a suitable to read (N>=2) complex numbers and to compute the
addition of N complex numbers.