Question Paper
Question Paper
A company records the monthly sales (in thousands) of different products as follows:
Products = ['Laptop', 'Smartphone', 'Tablet', 'Printer', 'Monitor']
Sales = [120, 250, 80, 60, 150]
Write a Python code to generate a Bar Chart to represent the given data. Include a suitable title
for the chart and labels for both X and Y axes. Additionally, save this chart as
sales_chart.png.
A. Display the names of students who have scored more than 80 marks.
B. Count the number of students from Delhi.
C. Write a query to display the details (RollNo, Name, Marks) of students who are from
"Delhi" and have scored above 75 marks.
D. Write a query to find the average marks obtained by students belonging to Delhi .
Temperature Variation
The temperature of a city over a week is recorded as:
Days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
Temperature = [30, 32, 31, 29, 28, 27, 26]
Write a Python program to create a line graph to represent the temperature variation. Add a title
"Weekly Temperature", label the X-axis as "Days" and the Y-axis as "Temperature (°C)". Save the
graph as weekly_temperature.png.
A. Write a query to display the names of employees who are from "New York."
B. Write a query to increase the salary of employees in the "IT" department by 10%.
C. Write a query to find the average salary of employees in each department.
D. Write a query to find the total salary paid to all employees in the "HR" department.
E. SELECT Name FROM Employee WHERE Salary BETWEEN 50000 AND 80000;
F. SELECT Name, LENGTH(Name) AS Name_Length FROM Employee;
G. SELECT NOW() AS Current_Date_Time;
1. Create a python program to construct pandas dataframe df using the given data.
Perform the following operations.
A. Display only the column Literacy Rate from the DataFrame DF.
B. Display the rows where Population is greater than 150 lakhs.
C. Calculate the population density (Population/Area) for each city and add it as a new column
called Population Density.
D. Filter the DataFrame to display cities with Hospitals greater than 200.
Write a Python program to plot a line graph showing revenue growth. Title the graph "Revenue
Growth (2018-2022)", label the X-axis as "Years" and the Y-axis as "Revenue (in million ₹)", and save
it as revenue_growth.png.
Write a Python program to generate a bar graph to display this data. Label the X-axis as "Fruit" and
the Y-axis as "Quantity Sold". Add the title "Fruit Sales Report" and save the graph as
fruit_sales.png.
A. Extract the last 4 characters of the product name for each product.
B. Delete the product with ProductID 104 .
C. Find the number of products in the 'Electronics' category.
D. Find the length of each product name.
Monthly Expenses
A family spends the following amounts on different items in a month:
Items = ['Rent', 'Groceries', 'Transport', 'Entertainment',
'Utilities']
Expenses = [20000, 8000, 3000, 2000, 5000]
Write a Python program to create a bar graph to visualize this data. Add a title "Monthly
Expenses", label the X-axis as "Items" and the Y-axis as "Expenses (in ₹)". Save the graph as
monthly_expenses.png.