0% found this document useful (0 votes)
16 views6 pages

SSCE VGS Set-4 updated

The document is an examination paper for the Senior Secondary Certificate Examination in Informatics Practices, consisting of questions related to Pandas, Matplotlib, and MySQL. It includes tasks such as creating a Pandas Series and DataFrame, generating a bar graph, and writing SQL queries for data analysis. The paper is divided into three main sections with specific questions and expected answers for each topic.

Uploaded by

jinanshjain8481
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)
16 views6 pages

SSCE VGS Set-4 updated

The document is an examination paper for the Senior Secondary Certificate Examination in Informatics Practices, consisting of questions related to Pandas, Matplotlib, and MySQL. It includes tasks such as creating a Pandas Series and DataFrame, generating a bar graph, and writing SQL queries for data analysis. The paper is divided into three main sections with specific questions and expected answers for each topic.

Uploaded by

jinanshjain8481
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/ 6

Senior Secondary Certificate Examination

School : VASISHTHA GENESIS SCHOOL


Time 3 Hours | Subject: Informatics Practices (065) | Max Marks : 30
Set 4
Question 1: Series and DataFrame Questions (5 Marks)

1. Create a Pandas Series from the list [7, 14, 21, 28, 35, 42, 49], with indices as ['A', 'B', 'C', 'D', 'E', 'F',
'G']. Perform the following operations:

o Replace the value at index 'D' with 99.

2. Create a Pandas DataFrame with the following data (include columns Car, Price, Year, Discount,
Tax, Price_with_Tax, and Price_Category):
Car Price Year Discount Tax Price_with_Tax Price_Category
Toyota 25000 2018 0.10 15% 28750 Affordable
Honda 27000 2019 0.12 15% 31050 Affordable
Ford 23000 2020 0.08 12% 25800 Affordable
BMW 45000 2021 0.15 18% 52710 Expensive
Audi 38000 2022 0.10 18% 44880 Expensive
Benz 70000 2023 0.18 20% 83400 Expensive
3. Filter and show only the cars whose Price_with_Tax is greater than 50000.
4. Add a new column called Mileage=[15, 14, 18, 12, 13, 10] representing the mileage of each car.
Then, calculate and add a column Price_per_Mileage which divides the Price by the Mileage for
each car. Display the updated DataFrame.
5. Create a new column Age representing the age of each car, calculated by subtracting the Year from
the current year (2025). Add the Age column to the DataFrame.
Question 2: Matplotlib Questions (3 Marks)
1. Create a bar graph to compare two groups of data for the following categories:
o Categories: ['A', 'B', 'C', 'D', 'E']
o Group 1 Values: [35, 40, 45, 50, 60]
o Group 2 Values:[30, 35, 40, 45, 55]`
➢ Plot two bars side by side for each category representing Group 1 and Group 2 values.
➢ Set the colors of the bars to be different (e.g., blue for Group 1 and orange for Group 2).
➢ Add appropriate title, labels for the x-axis and y-axis, and a legend to differentiate the two
groups.
o Customize the x-ticks to represent the categories properly.

Page 1 of 6
Question 3: MySQL Questions (7 Marks)
MySQL Tables
Table: Sales
SalesID Product Quantity SalesDate
1 Laptop 5 2023-01-10
2 Smartphone 10 2023-02-15
3 Tablet 7 2023-03-20
4 Headphone 20 2023-04-25
5 Keyboard 12 2023-05-30
6 Mouse 15 2023-06-05
7 Monitor 8 2023-07-10
8 Printer 3 2023-08-15

Table: Bill
BillID SalesID Category Amount BillDate
1 1 Electronics 12000 2023-01-15
2 2 Gadgets 8000 2023-02-20
3 3 Electronics 9000 2023-03-25
4 4 Accessories 15000 2023-04-30
5 5 Peripherals 7000 2023-05-05
6 6 Accessories 4000 2023-06-10
7 7 Monitors 10000 2023-07-15
8 8 Printers 5000 2023-08-20

1. Write a MySQL query to show the product name in uppercase, but only for products where the price
is greater than 10000.
2. Write a MySQL query to calculate the total sales (sum of Amount) from the 'Bill' table where the
category is 'Electronics'.
3. Write a MySQL query to display the count of unique products sold in each category.
4. Write a MySQL query to display all categories where the average Amount for that category is greater
than 8000.
5. Write a MySQL query to perform an equi join between 'Sales' and 'Bill' tables on 'SalesID' and select
only the Product, Category, and Amount columns where the Amount is greater than 5000.
6. Write a MySQL query to find the total sales and the average sales for each Product, and order the
result by total sales in descending order.
7. Write a MySQL query to calculate the MAX and MIN sales amounts for the year 2023.

External Examiner Internal Examiner


Name : _______________________ Name : _________________________
Sign : _______________________ Sign : _________________________
Examiner No: __________________ Examiner No: ____________________

Page 2 of 6
Set 4: Answer key
Question 1: Series and DataFrame Questions (5 Marks)

1. Create a Pandas Series from the list [7, 14, 21, 28, 35, 42, 49], with indices as ['A', 'B', 'C', 'D', 'E', 'F',
'G']. Perform the following operations:

o Replace the value at index 'D' with 99.

Answer:
import pandas as pd
data = [7, 14, 21, 28, 35, 42, 49]
index = ['A', 'B', 'C', 'D', 'E', 'F', 'G']
s= pd.Series(data, index=index)
s['D'] = 99 # Replace the value at index 'D' with 99
print(s)
2. Create a Pandas DataFrame with the following data (include columns Car, Price, Year, Discount,
Tax, Price_with_Tax, and Price_Category):
Car Price Year Discount Tax Price_with_Tax Price_Category
Toyota 25000 2018 0.10 15% 28750 Affordable
Honda 27000 2019 0.12 15% 31050 Affordable
Ford 23000 2020 0.08 12% 25800 Affordable
BMW 45000 2021 0.15 18% 52710 Expensive
Audi 38000 2022 0.10 18% 44880 Expensive
Benz 70000 2023 0.18 20% 83400 Expensive
Answer:
import pandas as pd
data = { 'Car': ['Toyota', 'Honda', 'Ford', 'BMW', 'Audi', 'Benz'],
'Price': [25000, 27000, 23000, 45000, 38000, 70000],
'Year': [2018, 2019, 2020, 2021, 2022, 2023],
'Discount': [0.10, 0.12, 0.08, 0.15, 0.10, 0.18],
'Tax': [0.15, 0.15, 0.12, 0.18, 0.18, 0.20] }
df = pd.DataFrame(data)
3. Filter and show only the cars whose Price_with_Tax is greater than 50000.
Answer:
expensive_cars = df[df['Price_with_Tax'] > 50000]
print(expensive_cars)
4. Add a new column called Mileage=[15, 14, 18, 12, 13, 10] representing the mileage of each car.
Then, calculate and add a column Price_per_Mileage which divides the Price by the Mileage for
each car. Display the updated DataFrame.
Answer: df['Mileage'] = [15, 14, 18, 12, 13, 10]

Page 3 of 6
df['Price_per_Mileage'] = df['Price'] / df['Mileage']
print(df)
5. Create a new column Age representing the age of each car, calculated by subtracting the Year from
the current year (2025). Add the Age column to the DataFrame.
Answer: # Add a new column 'Age' (Age = 2025 - Year)
df['Age'] = 2025 - df['Year']
Question 2: Matplotlib Questions (3 Marks)
1. Create a bar graph to compare two groups of data for the following categories:
o Categories: ['A', 'B', 'C', 'D', 'E']
o Group 1 Values: [35, 40, 45, 50, 60]
o Group 2 Values:[30, 35, 40, 45, 55]`
➢ Plot two bars side by side for each category representing Group 1 and Group 2 values.
➢ Set the colors of the bars to be different (e.g., blue for Group 1 and orange for Group 2).
➢ Add appropriate title, labels for the x-axis and y-axis, and a legend to differentiate the two
groups.
o Customize the x-ticks to represent the categories properly.
Answer:
import matplotlib.pyplot as plt
import numpy as np
categories = ['A', 'B', 'C', 'D', 'E']
group1_values = [35, 40, 45, 50, 60]
group2_values = [30, 35, 40, 45, 55]
n = len(categories) # Number of categories
x = np.arange(n) # X-axis positions for each group (shifting the bars for each group)
width = 0.35 # Width of each bar
plt.bar(x - width/2, group1_values, width, label='Group 1', color='blue') # Plotting the bars
plt.bar(x + width/2, group2_values, width, label='Group 2', color='orange') # Plotting the bars
plt.title('Comparison of Two Groups Across Categories') # Adding title and labels
plt.xlabel('Categories')
plt.ylabel('Values')
plt.xticks(x, categories) # Customizing x-ticks to represent the categories
plt.legend() # Adding legend
plt.show() # Show the graph
Question 3: MySQL Questions (7 Marks)
MySQL Tables
Table: Sales

Page 4 of 6
SalesID Product Quantity SalesDate
1 Laptop 5 2023-01-10
2 Smartphone 10 2023-02-15
3 Tablet 7 2023-03-20
4 Headphone 20 2023-04-25
5 Keyboard 12 2023-05-30
6 Mouse 15 2023-06-05
7 Monitor 8 2023-07-10
8 Printer 3 2023-08-15

Table: Bill
BillID SalesID Category Amount BillDate
1 1 Electronics 12000 2023-01-15
2 2 Gadgets 8000 2023-02-20
3 3 Electronics 9000 2023-03-25
4 4 Accessories 15000 2023-04-30
5 5 Peripherals 7000 2023-05-05
6 6 Accessories 4000 2023-06-10
7 7 Monitors 10000 2023-07-15
8 8 Printers 5000 2023-08-20

1. Write a MySQL query to show the product name in uppercase, but only for products where the price
is greater than 10000.
A: SELECT UPPER(Product) AS Product_Uppercase FROM Sales WHERE Price > 10000;
2. Write a MySQL query to calculate the total sales (sum of Amount) from the 'Bill' table where the
category is 'Electronics'.
A: SELECT SUM(Amount) AS Total_Sales FROM Bill WHERE Category = 'Electronics';
3. Write a MySQL query to display the count of unique products sold in each category.
A: SELECT Category, COUNT(DISTINCT Product) AS Unique_Products FROM Sales JOIN Bill
ON Sales.SalesID = Bill.SalesID GROUP BY Category;
4. Write a MySQL query to display all categories where the average Amount for that category is greater
than 8000.
A: SELECT Category, AVG(Amount) AS Avg_Amount FROM Bill GROUP BY Category
HAVING AVG(Amount) > 8000;

Page 5 of 6
5. Write a MySQL query to perform an equi join between 'Sales' and 'Bill' tables on 'SalesID' and select
only the Product, Category, and Amount columns where the Amount is greater than 5000.
A: SELECT Sales.Product, Bill.Category, Bill.Amount FROM Sales JOIN Bill ON Sales.SalesID =
Bill.SalesID WHERE Bill.Amount > 5000;

6. Write a MySQL query to find the total sales and the average sales for each Product, and order the
result by total sales in descending order.

A: SELECT Sales.Product, SUM(Bill.Amount) AS Total_Sales, AVG(Bill.Amount) AS Avg_Sales


FROM Sales JOIN Bill ON Sales.SalesID = Bill.SalesID GROUP BY Sales.Product ORDER BY
Total_Sales DESC;

7. Write a MySQL query to calculate the MAX and MIN sales amounts for the year 2023.

A: SELECT MAX(Amount) AS Max_Sales, MIN(Amount) AS Min_Sales FROM Bill WHERE


YEAR(BillDate) = 2023;

Page 6 of 6

You might also like