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

Python String Concepts

The document outlines important questions related to Object-Oriented Programming (OOP) in Python, covering concepts such as classes, objects, inheritance, method overriding, and exception handling. It includes practical programming tasks for creating classes like Student, Employee, and Circle, as well as examples of operator overloading and exception management. The questions aim to deepen understanding of OOP principles and Python's capabilities.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Python String Concepts

The document outlines important questions related to Object-Oriented Programming (OOP) in Python, covering concepts such as classes, objects, inheritance, method overriding, and exception handling. It includes practical programming tasks for creating classes like Student, Employee, and Circle, as well as examples of operator overloading and exception management. The questions aim to deepen understanding of OOP principles and Python's capabilities.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Important Questions - Unit 4

1. Explain the advantages of Object-Oriented Programming (OOP) over procedural programming


with examples.

2. What is class and object in Python? Explain with an example.

3. Define instance variables and class variables with examples.

4. Explain the lifecycle of an object in Python. How does Python handle object destruction?

5. Write a Python program to create a class Student with instance variables usn, name, and marks.
Create two objects and display the details of the student who has the highest mark.

6. Write a Python program to create a class Employee with the attributes: empid, empname,
empnohrs, empbasic, emphra(%), empda(%), empit(%), and empgross. Implement methods to
calculate gross salary based on given conditions.

7. Develop a Python program to create a class Circle with a member radius and methods to:
- Accept the radius from the user
- Find the area of the circle
- Find the perimeter of the circle
- Display all details

8. Explain inheritance in Python with an example. How does a child class access parent class
methods?

9. What is method overriding? Explain with an example in Python.

10. Explain multiple inheritance in Python with a suitable program.

11. What is operator overloading in Python? Explain with an example of overloading the `+` operator
for a user-defined class.

12. Write a Python program to overload the `>` (greater than) operator in a class.

13. Explain exception handling in Python with examples.

14. Write a Python program to check the validity of age. Raise an exception if the entered age is
negative.
15. Write a Python program that accepts two numbers from the user and performs their division.
Handle exceptions for division by zero and invalid input.

You might also like