Class XII CBSE Computer Science – Practical Practice Sets

 Class XII CBSE Computer Science – Practical Practice Sets

PRACTICE SET – 1

Part A – SQL

Consider the table STUDENT:

RollNoNameClassStreamMarksCity
101AmitXIIScience88Pune
102RiyaXIICommerce76Mumbai
103KaranXIIScience92Pune
104NehaXIICommerce81Delhi
105RahulXIIScience69Mumbai

Questions:

  1. Display all records from the table.
  2. Display the names and marks of students who scored more than 80.
  3. Display students belonging to Science stream.
  4. Display the names of students from Pune.
  5. Display students in descending order of marks.
  6. Find the maximum marks.
  7. Find the average marks.
  8. Count the number of students in each stream using GROUP BY.
  9. Display the highest marks obtained in each stream.
  10. Display students whose names start with R.

Part B – Pandas

Create the following DataFrame:

import pandas as pd

data = {
    'Name':['Amit','Riya','Karan','Neha','Rahul'],
    'Marks':[88,76,92,81,69],
    'City':['Pune','Mumbai','Pune','Delhi','Mumbai']
}

df = pd.DataFrame(data)

Perform:

  1. Display the DataFrame.
  2. Display the first 3 records.
  3. Display the last 2 records.
  4. Display only the Name and Marks columns.
  5. Display students having marks greater than 80.
  6. Add a column Result containing "Pass" for marks ≥ 40.
  7. Sort the DataFrame according to Marks.
  8. Find the maximum and average marks.

Part C – Matplotlib

Using the above data:

  1. Draw a bar graph showing Name vs Marks.
  2. Add title, X-axis label and Y-axis label.
  3. Display the graph using plt.show().

PRACTICE SET – 2

Part A – SQL

Consider the table EMPLOYEE:

EmpIDNameDepartmentSalaryCity
1RaviIT45000Pune
2SnehaHR38000Mumbai
3AkashIT52000Pune
4PriyaSales42000Delhi
5MohanHR35000Pune

Write SQL queries to:

  1. Display all employees.
  2. Display employees earning more than ₹40,000.
  3. Display employees working in IT.
  4. Display employees from Pune.
  5. Display employee names and salaries only.
  6. Find the minimum salary.
  7. Find the maximum salary.
  8. Find the average salary.
  9. Count employees department-wise.
  10. Find the total salary paid to employees of each department.
  11. Display employees whose names end with 'a'.
  12. Display employees in ascending order of salary.

Part B – Pandas

Create:

data = {
    'Employee':['Ravi','Sneha','Akash','Priya','Mohan'],
    'Department':['IT','HR','IT','Sales','HR'],
    'Salary':[45000,38000,52000,42000,35000]
}

df = pd.DataFrame(data)

Perform:

  1. Display df.head().
  2. Display df.tail().
  3. Display salary column.
  4. Display employees earning more than 40,000.
  5. Calculate the mean salary.
  6. Calculate maximum salary.
  7. Sort the DataFrame by Salary.
  8. Group employees according to Department.
  9. Find department-wise average salary.
  10. Add a new column Bonus equal to 10% of Salary.

PRACTICE SET – 3

Part A – Pandas Series

Create a Series containing marks of five students:

import pandas as pd

marks = pd.Series(
    [78, 85, 92, 67, 88],
    index=['Amit','Riya','Karan','Neha','Rahul']
)

Perform:

  1. Display the Series.
  2. Display the marks of Riya.
  3. Display marks of Amit and Karan.
  4. Display marks greater than 80.
  5. Find the maximum marks.
  6. Find the minimum marks.
  7. Find the average marks.
  8. Sort the Series.
  9. Display the index.
  10. Display the values.

Part B – DataFrame

Create:

data = {
    'Product':['Laptop','Mobile','Tablet','Printer','Keyboard'],
    'Price':[55000,25000,18000,12000,1500],
    'Quantity':[5,10,7,4,20]
}

df = pd.DataFrame(data)

Perform:

  1. Display the DataFrame.
  2. Display information about the DataFrame.
  3. Display the first three rows.
  4. Display products having price greater than ₹15,000.
  5. Add a column Amount = Price * Quantity.
  6. Find the total sales amount.
  7. Sort the DataFrame according to Price.
  8. Change the index of the DataFrame.
  9. Delete the Quantity column.
  10. Display the final DataFrame.

PRACTICE SET – 4

Data Handling + CSV

Create a DataFrame:

data = {
    'RollNo':[1,2,3,4,5,6],
    'Name':['Amit','Riya','Karan','Neha','Rahul','Sneha'],
    'English':[78,88,67,91,74,83],
    'Computer':[85,92,72,95,69,89],
    'Economics':[76,85,70,88,73,91]
}

df = pd.DataFrame(data)

Questions

  1. Display the complete DataFrame.
  2. Display the first 4 records.
  3. Display the last 3 records.
  4. Calculate the average marks in Computer.
  5. Find the maximum marks in Economics.
  6. Find the minimum marks in English.
  7. Add a column Total.
  8. Add a column Average.
  9. Display students having Average ≥ 80.
  10. Sort students according to Average in descending order.
  11. Export the DataFrame to a CSV file named student.csv.
  12. Import student.csv into another DataFrame.
  13. Display the imported DataFrame.

PRACTICE SET – 5

Pandas + Matplotlib

Consider the following sales data:

import pandas as pd

data = {
    'Month':['Jan','Feb','Mar','Apr','May','Jun'],
    'Sales':[25000,32000,28000,40000,45000,38000],
    'Expenses':[15000,18000,17000,22000,25000,21000]
}

df = pd.DataFrame(data)

Pandas Questions

  1. Display the DataFrame.
  2. Display the first three records.
  3. Find total sales.
  4. Find average sales.
  5. Find maximum sales.
  6. Find minimum expenses.
  7. Add a column Profit.

Formula:

Profit = Sales - Expenses
  1. Display the month having maximum sales.
  2. Sort the DataFrame according to Sales.
  3. Display months where Sales are greater than ₹30,000.

Matplotlib Questions

  1. Draw a line graph for Month vs Sales.
  2. Draw a bar graph for Month vs Sales.
  3. Draw a graph comparing Sales and Expenses.
  4. Add an appropriate title.
  5. Add X-axis and Y-axis labels.
  6. Add a legend wherever required.

PRACTICE SET – 6

SQL + Pandas + Matplotlib Integrated Practical

SQL

Consider two tables:

STUDENT

RollNoNameCourseIDMarks
1AmitC0185
2RiyaC0292
3KaranC0176
4NehaC0388
5RahulC0272

COURSE

CourseIDCourseName
C01Python
C02Data Science
C03Web Development

Write SQL queries to:

  1. Display all students.
  2. Display students scoring more than 80.
  3. Display students in descending order of marks.
  4. Find average marks.
  5. Find course-wise number of students.
  6. Find course-wise maximum marks.
  7. Display student names beginning with A.
  8. Display student names along with their course names using a JOIN.
  9. Display students enrolled in Data Science.
  10. Display students who scored between 75 and 90.

Pandas

Create a DataFrame using the student data and:

  1. Display the DataFrame.
  2. Display students with marks > 80.
  3. Calculate mean marks.
  4. Sort by marks.
  5. Add a Result column.
  6. Find the highest scorer.
  7. Export the DataFrame to CSV.

Matplotlib

Create:

  • Bar graph of Student vs Marks
  • Line graph of Student vs Marks
  • Appropriate title and axis labels.

Comments

Popular posts from this blog

india vs netherlands | "India vs Netherlands 2026: Economy, Education, Jobs, Tourism & Quality of Life Compared" | INDIA VS NETHERLAND

EduFlourish: Empowering Educational Excellence

TecwithAmey Enters the Gaming World with Three Exciting Browser Games