This article provides fully solved answers with Python (Pandas & Matplotlib) and SQL queries for the SSCE Practical Examination – Class 12 Informatics Practices (065) Solution. These solutions follow CBSE/State Board practical standards and help students score maximum marks.

Q1: Python with Pandas and Matplotlib (Scooter Data Analysis)

File name: scooter.csv

ScooterIDScooterNamePriceCompanyQty
S001Activa 6 G78000Honda18
S002NTorq88000TVS43
S003Jupiter77000TVS17
S004Access82000Suzuki24
S005Burgman95000Suzuki26

(a) Read CSV file and create Pandas DataFrame. [2]

(b) Display scooter names and price where quantity is less than 30. [1]

(c) Display top 3 records from the dataframe.         [1]

(d) Display scooter details manufactured by TVS and Suzuki         [1]

(e) Display the number of rows and columns of dataframe.          [1]

(f) Draw a line chart which represent scooter name on x-axis and price on y-axis. Label the chart properly and display legends.         [2]

Solution

import pandas as pd
# Ans. (a)
df = pd.read_csv("scooter.csv")
print(df)

# Ans. (b)

#Using Loc
print(df.loc[df['Qty'] < 30, ['ScooterName', 'Price']])

#Using Index
df[df['Qty'] < 30][['ScooterName', 'Price']]

#Using Query method
df.query("Qty < 30")[['ScooterName', 'Price']]

#Using Filter
df[df['Qty'] < 30].filter(['ScooterName', 'Price'])

#Using where
df[['ScooterName', 'Price']].where(df['Qty'] < 30).dropna()

#Ans. (c)
#Using head function
print(df.head(3))

#Using iloc
df.iloc[:3]

#Using loc
df.loc[0:2]

#Ans. (d)
#Using | operator
df[(df['Company'] == 'TVS') | (df['Company'] == 'Suzuki')]

#Using isin() function
print(df[df['Company'].isin(['TVS', 'Suzuki'])])

#Using query method
df.query("Company == 'TVS' or Company == 'Suzuki'")

#Using loc
df.loc[(df['Company'] == 'TVS') | (df['Company'] == 'Suzuki')]

#Ans (e)
#Using shape
print("Rows:", df.shape[0])
print("Columns:", df.shape[1])

#Using len() function
print("Rows:", len(df))
print("Columns:", len(df.columns))


#Ans (f)
import matplotlib.pyplot as plt

plt.plot(df['ScooterName'], df['Price'], marker='o', label='Scooter Price')
plt.xlabel("Scooter Name")
plt.ylabel("Price")
plt.title("Scooter Price Comparison")
plt.legend()
plt.show()

Q2: SQL Queries on Store Table

Table:Store

StidNameCityNoofemployeeDateopenedSalesamount
S101India martDelhi122020-05-18340000
S102Super marketMumbai202021-08-22390000
S103PlanetoriumDelhi172019-02-14240000
S104GulnazDelhi102022-04-01180000
S105LibaasMumbai82020-11-2420000
  1. Create the above given table with appropriate data type and constraints.               [1]
  2. Display Name and city of the store open in year 2020.     [1]
  3. Count the store in different city.               [1]
  4. Display the table details in ascending order of salesamount.         [1]
  5. Display the total noofemployees for stores in each city.  [1]
  6. Calculate the discount value for all bikes as 8% of salesamount.   [1]
  7. Display the stores open in the month of August. [1]

Solution

Ans.: (a)

CREATE TABLE Store (
    Stid VARCHAR(5) PRIMARY KEY,
    Name VARCHAR(30),
    City VARCHAR(20),
    Noofemployee INT,
    Dateopened DATE,
    Salesamount INT
);

Ans. (b)

SELECT Name, City
FROM Store
WHERE YEAR(Dateopened) = 2020;

Ans. (c)

SELECT City, COUNT(*) AS TotalStores
FROM Store
GROUP BY City;

Ans. (d)

SELECT *
FROM Store
ORDER BY Salesamount ASC;

Ans. (e)

SELECT City, SUM(Noofemployee) AS TotalEmployees
FROM Store
GROUP BY City;

Ans. (f)

SELECT Name, Salesamount, Salesamount * 0.08 AS Discount
FROM Store;

Ans. (g)

SELECT *
FROM Store
WHERE MONTH(Dateopened) = 8;

Q3: Practical File [5 Marks]

Marks awarded based on:

  • Proper record work
  • Correct programs
  • Output screenshots
  • Index and teacher signature

Q4: Project work [5 Marks]

Marks based on:

  • Project objective
  • Use of Pandas/CSV
  • Screenshots and outputs
  • Viva explanation

Q5: Viva-Voce [5 Marks]

Students may be asked:

  • Difference between DataFrame and Series
  • Use of GROUP BY
  • Meaning of primary key
  • CSV vs database
  • Plot types in Matplotlib

Conclusion

This article provides complete, accurate, and exam-ready solutions for the SSCE Informatics Practices Practical Exam.
Students should practice writing these answers by hand and execute code practically to score full marks.

Leave a Reply