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

Python Programming Assignment Guide

The document outlines a Python assignment consisting of various topics including Classes and Objects, Inheritance, Polymorphism, File Handling, NumPy, Pandas, and Matplotlib. Each topic presents a series of questions and programming tasks that require the application of Python concepts and techniques. Students are instructed to attempt any three questions from each topic.

Uploaded by

utkarsh5608singh
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)
2 views2 pages

Python Programming Assignment Guide

The document outlines a Python assignment consisting of various topics including Classes and Objects, Inheritance, Polymorphism, File Handling, NumPy, Pandas, and Matplotlib. Each topic presents a series of questions and programming tasks that require the application of Python concepts and techniques. Students are instructed to attempt any three questions from each topic.

Uploaded by

utkarsh5608singh
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

Python Assignment -2

Note: Attempt any three from each topic mentioned below.

Classes and Objects


1. Define a Python class. How is an object created from a class? Give an example.
2. Explain the use of the __init__() method with a code example.
3. Differentiate between class variables and instance variables in Python.
4. How can methods be defined and accessed inside a class? Explain with an example.
5. Write a Python program to demonstrate encapsulation using private variables.

Inheritance
6. What is inheritance in Python? Why is it used?
7. Explain single, multiple, and multilevel inheritance with suitable examples.
8. What is the super() function in Python? Illustrate its use with a program.
9. Differentiate between method overriding and method overloading with examples.
10. Write a Python program to demonstrate hierarchical inheritance.

Polymorphism
11. Define polymorphism. How is it implemented in Python?
12. Explain operator overloading in Python with an example.
13. How can polymorphism be achieved using inheritance? Give a suitable example.
14. Write a Python example demonstrating polymorphism with abstract classes.
15. Explain the role of duck typing in Python polymorphism.

File Handling
16. What are the different modes of opening a file in Python?
17. Write a Python program to read and write text files using open().
18. Explain the use of 'with' statement in file handling with an example.
19. How can you handle exceptions during file operations in Python?
20. Write a program to count the number of lines, words, and characters in a file.

NumPy
21. What is NumPy? How does it differ from Python lists?
22. Explain array creation methods like arange(), linspace(), and zeros() with examples.
23. Write a Python program to demonstrate reshape() and flatten() functions in NumPy.
24. What is broadcasting in NumPy? Explain with an example.
25. Write a Python program to perform element-wise operations on two arrays.

Pandas
26. What is a DataFrame in Pandas? How is it different from a NumPy array?
27. Write a Python program to create a DataFrame from a dictionary.
28. Explain the use of loc[] and iloc[] in Pandas with examples.
29. Demonstrate the use of groupby() and aggregate functions in Pandas.

Matplotlib
30. Write a Python program to create a line chart using Matplotlib.
31. Explain different types of plots supported by Matplotlib.
32. How can you customize titles, labels, and legends in a Matplotlib graph?
33. Write a Python program to plot multiple subplots in a single figure.

You might also like