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

OOP, File Handling, NumPy & Pandas Guide

The document outlines a comprehensive curriculum covering Object-Oriented Programming, File and Exception Handling, and NumPy in Unit 1, followed by Data Manipulation using Pandas in Unit 2. It includes theoretical questions, coding exercises, and programming patterns to demonstrate understanding of key concepts and practical applications. Topics range from class definitions and inheritance to data structures in Pandas, exception handling, and data visualization techniques.
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)
12 views5 pages

OOP, File Handling, NumPy & Pandas Guide

The document outlines a comprehensive curriculum covering Object-Oriented Programming, File and Exception Handling, and NumPy in Unit 1, followed by Data Manipulation using Pandas in Unit 2. It includes theoretical questions, coding exercises, and programming patterns to demonstrate understanding of key concepts and practical applications. Topics range from class definitions and inheritance to data structures in Pandas, exception handling, and data visualization techniques.
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

UNIT 1: Object-Oriented Programming, File & Exception Handling,

NumPy

1. Explain the concept of Object-Oriented Programming in


Python.
How are classes and objects defined? Provide real-world analogies.

2. Differentiate between a class and an object with examples.

3. What is the purpose of the __init__() method in Python


classes?
Explain constructor overloading with examples.

4. What is the difference between instance methods and class


methods?
Explain with appropriate Python code.

5. Demonstrate various types of inheritance in Python.


Examples: Single, Multiple, Multilevel, Hierarchical, and Hybrid
inheritance.

6. What is method overriding and method overloading? Explain


with examples.

7. What are access specifiers in Python?


Describe public, protected, and private members.

8. What is exception handling?


Why is it important in Python programming?

9. Write a program that uses try-except-finally blocks.


Show the control flow in each case.

10. Explain custom exception creation in Python.


Write a class that defines a user-defined exception.

11. Describe different types of file modes used in Python


(r, w, a, rb, etc.).

12. What are the functions to read from and write to a file
in Python?
Use read(), readline(), readlines(), write(), and writelines().

13. Compare text file handling vs binary file handling in


Python.

14. What is NumPy? Why is it preferred over Python lists


for numerical operations?
15. How do you convert a list and tuple into a NumPy
array?
Show the use of array() function.

16. Explain and demonstrate how broadcasting works in


NumPy.

17. What is the difference between [Link](), [Link](),


and [Link]()?

18. What is the use of arange() and linspace() in NumPy?

19. Explain vectorized operations in NumPy with examples.

20. What is the use of axis in NumPy operations?


Show difference using sum(axis=0) vs sum(axis=1).

UNIT 2: Data Manipulation using Pandas

21. What are the key data structures in Pandas?


Explain Series, DataFrame, and Index with examples.

22. What are the ways to create a DataFrame in Pandas?


List at least 3 different methods.

23. What is the difference between loc[] and iloc[] in


Pandas?

24. What is indexing and reindexing in Pandas?


Demonstrate how to change row labels.

25. How can missing values be detected and handled in


Pandas?
Use isnull(), notnull(), fillna(), dropna().

26. What is the use of apply(), map() and applymap() in


Pandas?
Explain the differences with examples.

27. How can you sort DataFrame rows and columns?


Use sort_values() and sort_index().

28. Explain how to filter data using boolean indexing.

29. What is grouping in Pandas?


How do you perform aggregation functions like mean, sum, count on
grouped data?

30. How do you concatenate multiple DataFrames


vertically and horizontally?
31. Differentiate between merge() and join() in Pandas.

32. How can you reset and set index in a DataFrame?


Demonstrate reset_index() and set_index().

33. How do you rename columns and rows in a DataFrame?

34. What are descriptive statistics methods in Pandas?


Explain mean(), median(), mode(), std(), describe().

35. Explain how to export DataFrames to CSV and Excel


files.

36. Demonstrate how to plot basic graphs using Pandas


built-in visualization tools.
Use plot(kind='line'), plot(kind='bar'), plot(kind='hist').

37. What are lambda functions and how are they used in
Pandas operations?

38. What is chaining in Pandas and why is it discouraged in


some cases?

39. What are the advantages of using Pandas in data


science?

40. Explain a real-life application scenario where NumPy


and Pandas are used together.

Coding Questions: First refer your syllabus coding questions and


solve it

UNIT 1: OOP, File Handling, Exception Handling, NumPy

1. Define a Python class Person with attributes like name, age,


weight, height and a method to calculate BMI.

o Also print the BMI category (underweight, healthy, obese).

2. Write a Python program to demonstrate:

o Single Inheritance

o Multilevel Inheritance

o Multiple Inheritance

3. Write a program to handle the following exceptions:

o ValueError

o IndexError
o TypeError

o NameError

o ZeroDivisionError

4. Write a Python program to:

o Create a NumPy array from a list and tuple (float type).

o Display its shape, size, ndim, and dtype.

5. Write a Python program to demonstrate:

o NumPy array slicing

o Integer indexing

o Boolean indexing

6. Write a program to compute:

o Minimum, maximum, sum, and cumulative sum of a NumPy


array.

UNIT 2: Pandas and Data Manipulation

7. Write a Python program to:

o Create a Pandas Series with custom labels

o Create a Series from a dictionary

8. Write a program to:

o Create a DataFrame using Pandas

o Use head(), tail() and describe() methods on the DataFrame

9. Write a program to perform the following on a DataFrame:

o Add a new column

o Delete an existing column

o Select specific columns

10. Write a program to:

 Select, add, and delete rows in a Pandas DataFrame

11. Write a program to:

 Get the top 3 highest values in a column of a DataFrame


 Get the bottom 2 lowest values

12. Write a Python program to:

 Convert Pandas DataFrame and Series into NumPy arrays

13. Write a program using Pandas to plot:

 Histogram

 Line Plot

 Scatter Plot

 Bar Plot

14. Write a Python program using Pandas to group data


and calculate aggregates (e.g., mean, count).

15. Write a program to:

 Merge two DataFrames

 Join and concatenate DataFrames

16. Write a Python program to:

 Read data from a CSV file using read_csv()

 Read data from an Excel file using read_excel()

17. Write a program to:

 Detect missing values using isnull()

 Replace them with a specific value using fillna()

Additional Programming Patterns that May Appear (in 5–10 marks


format)

 Difference between class and object with code

 Use of try-except-finally with example

 Demonstrating DataFrame filtering using boolean conditions

 Using groupby() to show mean of grouped data

 Using Pandas to load a CSV and summarize it

You might also like