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

Question Paper

Uploaded by

viji mantharam
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)
12 views5 pages

Question Paper

Uploaded by

viji mantharam
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
You are on page 1/ 5

1. Create a python program to construct pandas dataframe df using the given data.

Perform the following operations.

A. Display only the column Price from the DataFrame DF.


B. Display the row details of P003.
C. Display the columns Product Name and Discount (%) for P001 and P004.
D. Calculate the total cost (Price * Quantity) for each product and add it as a new column
Total Cost.

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.

2. Consider the table students .

Write SQL queries for the following:

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 .

Predict output for the following Queries

E. SELECT * FROM Students WHERE Marks = (SELECT MAX(Marks) FROM Students);


F. SELECT Name FROM Students WHERE Name LIKE 'A%';
G. SELECT SUM(Marks) AS Total_Marks FROM Students;
1. Create a python program to construct pandas dataframe df using the given data.
Perform the following operations.

A. Display only the column Electronics from the DataFrame DF.


B. Display the row details of AP and OD from DataFrame DF.
C. Display the columns Furniture and Grocery for MP and UP from DataFrame DF.
D. Add a new column Total Production that is the sum of all the products for each state.

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.

2. Consider the table employee

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.

Predict output for the following Queries

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.

Company Revenue Growth


A company's revenue over five years is as follows:
Years = [2018, 2019, 2020, 2021, 2022]
Revenue = [50, 60, 65, 70, 85] (in million ₹)

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.

2. Consider the table orders

A. Write a query to find the number of orders with "Delivered" status.


B. List all orders placed between December 1, 2024, and December 10, 2024.
C. Update the status of all orders placed before December 10, 2024, to 'Shipped'.
D. List orders whose amount is greater than $2000, and order them by the order date in
descending order.

Predict output for the following Queries

E. SELECT CustomerName, LEFT(CustomerName, 3) AS First_3_Chars FROM Orders;


F. SELECT OrderID, Amount, ROUND(Amount, 2) AS Rounded_Amount FROM Orders;
G. SELECT CustomerName FROM Orders WHERE CustomerName LIKE '%e%';
1. Create a python program to construct pandas dataframe df using the given data.
Perform the following operations.

A. Display the rows where the Region is "North" .


B. Calculate and add a new column Profit (Sales - Expenses).
C. Filter the rows where Profit is greater than ₹50,000.
D. Delete rows of store A

Fruit Sales in a Week


A shopkeeper sells the following quantities of fruits in a week:
Fruits = ['Apple', 'Banana', 'Mango', 'Orange', 'Grapes']
Quantity = [150, 300, 200, 250, 180]

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.

2. Consider the table product

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.

Predict output for the following

E. SELECT * FROM Product WHERE ProductName LIKE 'S%';


F. SELECT ProductName, POSITION('e' IN ProductName) AS Position_of_e FROM Product;
G. SELECT * FROM Product ORDER BY Price ASC
1. Create a python program to construct pandas dataframe df using the given data.
Perform the following operations.

A. Display Name and Salary of employee E103


B. Add a new column Total Marks as the sum of Math, Science, and English.
C. Filter and display the students who scored more than 250 in Total Marks.
D. Write a command to delete Science marks for all students.

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.

2. Consider the table product

Write queries for the following


A. Display average Price of Products in Each Category
B. To Count Products Above a 5000Rs in Each Category
C. Delete the Product with ProductID 104
D. Extract the Last 4 Characters of Product Names

Predict output for the following


E. SELECT * FROM Product ORDER BY Price ASC;
F. SELECT ProductName, POSITION('e' IN ProductName) AS Position_of_e FROM Product;
G. SELECT ProductName, LENGTH(ProductName) AS Name_Length FROM Product;

You might also like