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

Constitution

Uploaded by

bhuvanbg860
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)
24 views

Constitution

Uploaded by

bhuvanbg860
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
You are on page 1/ 3

UNIT-IV

1) You are tasked with automating a repetitive file-renaming task. How would you
approach this problem using Python? Write a Python script to rename files in a
folder sequentially (e.g., file1.txt, file2.txt).
2) What is Python, and why is it widely used in fields such as data science and web
development? List its key features.
3) Your data science team uses Google Colab for collaborative analysis. How would
you upload a dataset and visualize the first five rows using Python in Google Colab?
4) Explain the advantages of using Google Colab over local development
environments.
5) You are building a tip calculator for a restaurant. Ask the user to input the bill
amount (float), calculate a 15% tip, and display the result.
6) Differentiate between mutable and immutable data types in Python. Are integers
mutable?
7) Create a program that accepts a sentence from the user and performs the
following: Counts the number of words. Replaces all occurrences of the word
"Python" with "Coding".
8) What is the difference between the find() and index() string methods? Explain with
examples.
9) Write a program that accepts a user’s name and age, and prints: "Hello [Name], in
10 years, you will be [Age + 10] years old."
10) How does the input() function handle different data types? How can you ensure
the input is of a specific type, like an integer?
11) Write a program that calculates the square root of a number. Include error
handling to manage invalid inputs like strings or negative numbers.
12) Develop a program that prints the multiplication table for a user-specified
number using a for loop. Add input validation to ensure the user enters only
positive integers.
13) Explain the differences between a while loop and a for loop. When would you
choose one over the other?
14) Write a program to accept a list of numbers from the user. Sort the list in
ascending order and remove any duplicates.
15) What is the difference between append() and extend() in Python lists? Provide
examples.
16) You are given a tuple containing product prices. Write a Python function that
calculates the average price.
17) Why are tuples immutable? How does immutability impact their performance
compared to lists?
18) Create a Python program to find the union, intersection, and difference between
two sets of student names.
19) What are some real-life use cases of sets in Python? How do they differ from
lists?
20) Create a dictionary to store the marks of students in three subjects. Write a
program to calculate and display each student’s average mark.
21) What are dictionary keys, and why must they be immutable? Can you use a list
as a dictionary key?
22) Your team needs a data visualization library. Research and provide a brief script
that uses Matplotlib to create a simple bar chart.
23) What is a Python library? Explain how libraries like Pandas, Matplotlib, and
NumPy are used in different domains.
24) Write a Python program to create a 3x3 NumPy array filled with random integers.
Calculate its row-wise and column-wise sums.
25) How do NumPy arrays differ from Python lists? Why are NumPy arrays preferred
in data processing?
26) Create a 4D NumPy array to store monthly sales data for four products across
three regions over two years. Write a script to calculate the total sales for each
product.
27) Explain the concept of high-dimensional arrays. How does slicing work in a 3D or
4D NumPy array?
UNIT-V

1) A factory tracks the daily production count of 10 machines. Write a Python


program to store the counts in a NumPy array and calculate the total production
for the day.
2) How can you create a NumPy array using a list, and how does it differ from a
Python list in terms of memory efficiency?
3) You are given a NumPy array representing test scores for 5 students in 3
subjects. Extract the scores for the 2nd student and the scores for all students in
the 3rd subject.
4) Explain the difference between integer indexing and boolean indexing in NumPy
with examples.
5) Create a 3x3 NumPy array of ones. Write a script to determine its shape, size,
data type, and memory consumption.
6) What are the key attributes of a NumPy array? Explain the purpose of ndim,
shape, and dtype.
7) Create a 4x5 array filled with random integers between 1 and 100. Extract: The
first two rows.
8) The last column. Every alternate element from the second row.
9) How does slicing in NumPy differ from slicing in Python lists? Explain with
examples.
10) A company tracks monthly salaries for its 100 employees. Use NumPy to
calculate the 25th, 50th (median), and 75th percentiles of the salaries.
11) What is a percentile? How can it be calculated using NumPy’s percentile()
function?
12) Write a program that calculates the variance of rainfall data collected over a year
using a NumPy array. Explain how variance helps in analyzing the dataset.
13) Define variance and explain its significance. How does NumPy’s var() function
work, and what do its parameters (e.g., axis) mean?
14) Create a DataFrame to represent sales data for a store (Product Name, Quantity,
Price). Display the first five rows of the DataFrame.
15) What is Pandas, and why is it preferred for data manipulation over NumPy?
16) Create a Pandas Series to store the temperatures for the last 7 days. Also, create
a DataFrame to represent student data (Name, Age, Grade).
17) Explain the differences between a Pandas Series and a Pandas DataFrame.
Provide examples of when each would be used.
18) Create a DataFrame to store monthly sales data for 3 products. Write a script to
calculate the total sales for each product and the grand total.
19) What are some common operations you can perform on a DataFrame? Explain
with examples.
20) Write a script to query and display all rows where the sales for a specific product
exceeded 500 units.
21) Detailed Question:
22) Explain the syntax for filtering rows in a DataFrame. What is the difference
between .query() and boolean indexing?
23) You have a DataFrame representing student grades. Write a function to classify
students as "Pass" or "Fail" based on their grades and apply it to the DataFrame.
24) How do the apply() and applymap() functions work in Pandas? Provide examples.
25) Discuss how you would represent a 2D dataset using both NumPy and Pandas.
Which one would you choose for operations like filtering or adding a new column,
and why?
26) Detailed Question:
27) What are the key differences between NumPy and Pandas in terms of
functionality and use cases?
28) Perform a speed comparison between NumPy and Pandas for the task of
summing up all elements in a large dataset (e.g., 1 million numbers).
29) Why is NumPy generally faster than Pandas for numerical computations? Provide
examples of scenarios where Pandas might be slower.
30) Your team needs to generate interactive visualizations for a sales report. Suggest
a suitable Python library and write a script to generate a simple bar chart.
31) List some popular Python libraries for data analysis and visualization. Describe
their use cases briefly.

You might also like