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

Question-Bank python

The document is a comprehensive question bank covering various topics in Python programming, including fundamentals, control structures, object-oriented programming, NumPy, Pandas, and data visualization. Each unit contains multiple questions designed to test knowledge and understanding of key concepts and practical applications. The questions range from basic definitions to coding exercises and data analysis techniques.

Uploaded by

scs623170
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
2 views3 pages

Question-Bank python

The document is a comprehensive question bank covering various topics in Python programming, including fundamentals, control structures, object-oriented programming, NumPy, Pandas, and data visualization. Each unit contains multiple questions designed to test knowledge and understanding of key concepts and practical applications. The questions range from basic definitions to coding exercises and data analysis techniques.

Uploaded by

scs623170
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 3

Questions Bank

Unit 1: Introduction to Python

1. What are identifiers and keywords in Python, and why is it important to follow
identifier naming conventions?
2. Explain the difference between integral and floating-point types in Python, and
provide examples of each.
3. How do you compare two strings in Python? Write a code snippet that checks if two
strings are equal or which one is lexicographically greater.
4. Demonstrate string slicing and striding with examples, and explain how they work
with negative indices.
5. What is the purpose of the str.format method? Show examples of how it can be
used for string formatting with multiple variables.
6. Explain tuples in Python. How are they different from lists, and in what scenarios
would you use a tuple over a list?
7. Describe the properties of a Python set. How does it handle duplicate values, and what
are some common set operations?
8. What are dictionaries in Python, and how do they store key-value pairs? Illustrate
with an example.
9. Write a code snippet to iterate over a dictionary, printing each key and its
corresponding value.
10. Explain shallow vs. deep copying in Python collections with an example using lists.

Unit 2: Python Control Structures, Functions, and OOP

1. Describe the different types of conditional statements in Python, and write an example
using if, elif, and else.
2. What are the various looping structures in Python? Write a program that uses a while
loop to find the factorial of a number.
3. Explain exception handling in Python with examples. How would you handle multiple
exceptions in a single block?
4. Write a custom function that takes a list of numbers and returns the average of those
numbers. Include error handling to manage an empty list.
5. Demonstrate how to use Python’s built-in random and math modules in a program
that simulates rolling two dice and calculates the average roll value.
6. Describe the purpose of the os and shutil modules in Python. Provide an example
where both modules are used to move files from one directory to another.
7. What is inheritance in OOP? Write a Python class Vehicle and a subclass Car that
inherits from Vehicle, adding an attribute unique to Car.
8. Explain polymorphism in Python with an example involving two classes that
implement a common method but with different functionalities.
9. Describe how to create a custom module in Python. Write an example where you
create a module with a function that calculates the area of a circle.
10. Explain how to read and write text files in Python. Write a program that reads a file
line by line and counts the number of lines that contain a specific word.
Unit 3: NumPy Arrays and Vectorized Computations

1. What is a NumPy array, and how does it differ from a Python list? Illustrate with
examples.
2. Describe three different ways to create an array in NumPy. Provide a code snippet for
each method.
3. Explain array indexing in NumPy. Write a code example that extracts a 2x2 subarray
from a 3x3 array.
4. What is “fancy indexing” in NumPy? How does it differ from slicing, and when
would you use it?
5. Illustrate basic arithmetic operations on NumPy arrays with examples. How do these
operations differ from operations on Python lists?
6. List and explain any four commonly used array functions in NumPy, providing a code
example for each.
7. Write a program that uses NumPy to load a dataset from a file, perform a calculation
on each row, and save the modified data to a new file.
8. Explain the process of loading and saving arrays using NumPy functions np.save and
np.load. Why are these functions efficient?
9. What is the purpose of the NumPy linalg (linear algebra) module? Provide an
example using a matrix to demonstrate matrix multiplication and finding the
determinant.
10. Demonstrate the use of the np.random module to generate a 5x5 array of random
numbers. Explain different types of random number distributions available in NumPy.

Unit 4: Data Analysis with Pandas

1. Define the Pandas library and its key use cases in data analysis.
2. Explain the Pandas Series data structure with an example.
3. Describe how to create a DataFrame in Pandas using a dictionary.
4. What is reindexing in Pandas, and why is it useful?
5. Explain the difference between .head() and .tail() methods in Pandas.
6. How can binary operations be performed in Pandas DataFrame?
7. Illustrate the use of functional statistics methods like .mean() and .median() in
Pandas.
8. Describe how missing data is handled in Pandas.
9. What is hierarchical indexing in Pandas, and how is it used for advanced data
analysis?
10. Explain the Panel data structure in Pandas and its primary applications.

Unit 5: Data Analysis Application Examples

1. Define data munging and describe its importance in data analysis.


2. Explain the steps involved in cleaning a dataset in Pandas.
3. How can data be filtered in Pandas based on specific conditions?
4. Demonstrate how to merge two datasets in Pandas using different types of joins.
5. What are the key methods for reshaping data in Pandas?
6. Illustrate the use of .groupby() for grouping data in Pandas with an example.
7. How can aggregated statistics, such as sum or average, be computed for grouped data
in Pandas?
8. Provide an example of how to handle duplicate values in a dataset using Pandas.
9. Explain the importance of handling outliers and how it can be done using Pandas.
10. What are the common challenges faced during data cleaning and how can Pandas help
resolve them?

Unit 6: Data Visualization

1. What is the matplotlib API, and how does it integrate with Pandas?
2. Explain the role of line properties in matplotlib visualizations.
3. How can multiple subplots be created in a single figure using matplotlib?
4. Illustrate the process of creating a scatter plot using matplotlib.
5. How do you customize bar plots in matplotlib? Provide an example.
6. Explain the importance of legends and annotations in visualizations with examples.
7. How can a histogram plot be created and used for data distribution analysis?
8. Describe how to visualize data directly using Pandas plotting functions.
9. Compare scatter plots and bar plots with respect to their use cases.
10. How can annotations be added to a matplotlib plot to highlight specific data points?

You might also like