Practical File Computer Science Class 12 with complete solution provides you with complete practical solutions for a Computer science class 12 curriculum. As per the curriculum for 2023-24 the following topics should be covered in practicals:

  1. Working with functions
  2. Exception Handling
  3. Data File Handling
  4. Data Structure
  5. Database Management (MySQL)
  6. Python-MySQL Connectivity

So let us begin this article!

Structure of Practical Exam – Practical File Computer Science Class 12

As per the syllabus of CBSE for Computer Science Class 12, the practical exam structure would be as follows:

S. NoComponentMarks
Total 30
11. Python program(60% Logic + 20% documentation + 20% code quality)
2. SQL queries (4 queries based on one or two tables)
8
4
2


Report file:
1. Minimum 15 Python programs based on Functions, Exception Handling, File handling, and Stack
2. SQL Queries – Minimum 5 sets using one table/two tables
3. Minimum 4 programs based on Python – SQL Connectivity
7
3Project (using concepts learnt in Classes 11 and 12)8
4Viva Voce3
Total30

Suggested Practical List for Practical File Computer Science Class 12

The following programs are given in the suggested program list by CBSE and can be used in Practical File Computer Science Class 12.

Python Programming

  • Read a text file line by line and display each word separated by a #.
  • Read a text file and display the number of vowels/consonants/uppercase/lowercase characters in the file.
  • Remove all the lines that contain the character ‘a’ in a file and write it to another file.
  • Create a binary file with the name and roll number. Search for a given roll number and display the name, if not found display the appropriate message.
  • Create a binary file with roll number, name, and marks. Input a roll number and update the marks.
  • Write a random number generator that generates random numbers between 1 and 6 (simulates a dice).
  • Create a CSV file by entering user-id and password, and read and search for the password for the given user.

Database Management

  • Create a student table and insert data. Implement the following SQL commands on the student table:
  • ALTER table to add new attributes / modify data type/drop attribute
  • UPDATE table to modify data
  • ORDER By to display data in ascending/descending order
  • DELETE to remove tuple(s)
  • GROUP BY and find the min, max, sum, count, and average
  • A similar exercise may be framed for other cases.
  • Integrate SQL with Python by importing a suitable module.

List of Programs for Practical File Computer Science Class 12

I will start the programs from the functions and then data file handling. You can use the suggested list of programs as well in your Practical File Computer Science Class 12.

Programs based on working with functions

The first three programs of Practical File Computer Science Class 12 are taken from the topic and chapter working with functions.

  1. Write a Python program using a function to print factorial number series from n to m numbers.
  2. Write a Python program to accept the username “Admin” as the default argument and password 123 entered by the user to allow login into the system.
  3. Write a Python program to demonstrate the concept of variable length argument to calculate the product and power of the first 10 numbers.

If you are looking for more content on working with functions class12 follow the below-given links:

Working with Functions
NotesQuestionsPractical

In the next section of Practical File Computer Science Class 12, I will add some programs based on data file handling.

Programs based on exception handling

  1. Write a Python program to accept a list as a function parameter and raise the IndexError exception.
  2. Write a program to accept the number of days and display appropriate weeks in an integer. Display an appropriate error message through multiple exception handling including the finally clause.

Programs based on data file handling text files

  1. Create a text file “intro.txt” in Python and ask the user to write a single line of text by user input.
  2. Write a program to count the total number of lines and count the total number of lines starting with ‘A’, ‘B’, and ‘C’ from the file dfh.txt.
  3. Write a program to replace all spaces from text with – (dash) from the file intro.txt.
  4. Write a program to know the cursor position and print the text according to the below-given specifications:
    • Print the initial position
    • Move the cursor to 4th position
    • Display the next 5 characters
    • Move the cursor to the next 10 characters
    • Print the current cursor position
    • Print the next 10 characters from the current cursor position

If you are looking for more content on data file handling follow below given links:

Data File Handling in Python – Text Files Notes
Data File Handling in Python – Text Files Questions
Data File handling in Python – Text File Practicals

In the next section of Practical File Computer Science Class 12 you will get some programs based on data file handling for binary files.

Programs based on data file handling binary files

  1. Write a program to store customer data into a binary file cust.dat using a dictionary and print them on the screen after reading them. The customer data contains ID as a key, and name, and city as values.
  2. Write a program to create a binary file sales.dat and write a menu-driven program to do the following:
    • Insert record
    • Search Record
    • Update Record
    • Display record
    • Exit
  3. Write a function to write data into binary file marks.dat and display the records of students who scored more than 95 marks.

For more study material follow these links:

Class 12 Binary File – Practicals

The next section of Practical File Computer Science Class 12 consists of programs based on CSV Files. Let’s see them!

Programs based on data file handling CSV files

[1] Read a CSV file top5.csv and print the contents in a proper format. The data for the top5.csv file are as follows:

SNoBatsmanTeamRunsHighest
1K L RahulKXI670132*
2S DhawanDC618106*
3David WarnerSRH54885*
4Shreyas IyerDC51988*
5Ishan KishanMI51699

[2] Read a CSV file students.csv and print them with a tab delimiter. Ignore the first-row header to print in tabular form.

[3] Write records of students into result.csv. The fields are as follows:

Field 1Data Type
StudentIDInteger
StudentNameString
ScoreInteger

Programs based on data structure stack

  1. Write a menu-driven Python program to implement stack operation.
  2. Write a program to implement a stack for the employee details (empno, name).

MySQL 5 Sets of queries based on one table/two tables

Queries Set 1 (Database Fetching records)

[1] Consider the following MOVIE table and write the SQL queries based on it.

Movie_IDMovieNameTypeReleaseDateProductionCostBusinessCost
M001DahekAction2022/01/2612450001300000
M002AttackAction2022/01/2811200001250000
M003Looop LapetaThriller2022/02/01250000300000
M004Badhai DoDrama2022/02/0472000068000
M005Shabaash MithuBiography2022/02/041000000800000
M006GehraiyaanRomance2022/02/11150000120000
  1. Display all information from movie.
  2. Display the type of movies.
  3. Display movieid, moviename, total_eraning by showing the business done by the movies. Claculate the business done by movie using the sum of productioncost and businesscost.
  4. Display movieid, moviename and productioncost for all movies with productioncost greater thatn 150000 and less than 1000000.
  5. Display the movie of type action and romance.

Queries set 2 (Aggregate Functions)

Aggregate function queries Practical File Computer Science Class 12

Consider the given table patient and Write following queries:

  1. Display the total charges of patients admitted in the month of November.
  2. Display the eldest patient with name and age.
  3. Count the unique departments.
  4. Display average charges.

Queries set 3 (DDL Commands)

Suppose your school management has decided to conduct cricket matches between students of Class XI and Class XII. Students of each class are asked to join any one of the four teams – Team Titan, Team Rockers, Team Magnet and Team Hurricane. During summer vacations, various matches will be conducted between these teams. Help your sports teacher to do the following:

  1. Create a database “Sports”.
  2. Create a table “TEAM” with following considerations:
    • It should have a column TeamID for storing an integer value between 1 to 9, which refers to unique identification of a team.
    • Each TeamID should have its associated name (TeamName), which should be a string of length not less than 10 characters.
    • Using table level constraint, make TeamID as the primary key.
    • Show the structure of the table TEAM using a SQL statement.
    • As per the preferences of the students four teams were formed as given below. Insert these four rows in TEAM table:
    • Row 1: (1, Tehlka)
    • Row 2: (2, Toofan)
    • Row 3: (3, Aandhi)
    • Row 3: (4, Shailab)
    • Show the contents of the table TEAM using a DML statement.
  3. Now create another table MATCH_DETAILS and insert data as shown below. Choose appropriate data types and constraints for each attribute.
MatchIDMatchDateFirstTeamIDSecondTeamIDFirstTeamScoreSecondTeamScore
M12021/12/201210793
M22021/12/2134156158
M32021/12/22138681
M42021/12/23246567
M52021/12/24145288
M62021/12/25239768

Queries set 4 (Based on Two Tables)

  1. Display the matchid, teamid, teamscore who scored more than 70 in the first inning along with team name.
  2. Display matchid, teamname and secondteamscore between 100 to 160.
  3. Display matchid, teamnames along with matchdates.
  4. Display unique team names
  5. Display matchid and matchdate played by Anadhi and Shailab.

Queries Set 5 (Group by , Order By)

Consider the following table stock table to answer the queries:

itemnoitemdcodeqtyunitpricestockdate
S005Ballpen102100102018/04/22
S003Gel Pen101150152018/03/18
S002Pencil10212552018/02/25
S006Eraser10120032018/01/12
S001Sharpner10321052018/06/11
S004Compass10260352018/05/10
S009A4 Papers10216052018/07/17
  1. Display all the items in the ascending order of stockdate.
  2. Display maximum price of items for each dealer individually as per dcode from stock.
  3. Display all the items in descending orders of itemnames.
  4. Display average price of items for each dealer individually as per doce from stock which avergae price is more than 5.
  5. Diisplay the sum of quantity for each dcode.

Programs based on Python – MySQL Connectivity

  1. Write a MySQL connectivity program in Python to
    • Create a database school
    • Create a table students with the specifications – ROLLNO integer, STNAME character(10) in MySQL and perform the following operations:
      • Insert two records in it
      • Display the contents of the table
  2. Perform all the operations with reference to table ‘students’ through MySQL-Python connectivity.
  3. Write a menu-driven program to store data into a MySQL database named shop and table customer as following:
    1. Add customer details
    2. Update customer details
    3. Delete customer details
    4. Display all customer details
  4. Modify the above program and display the customer details based on the following menu:
    1. Display customer details by city
    2. Display customer details by bill amount
    3. Display customer details by name
    4. Display customer details by category

Download the Practical File Computer Science Class 12 PDF

Download the Term 1 Practical File CS Class 12 initial pages in word format by following the below-given link:

Practical File Computer Science Class 12 in word format Initial pages

Follow this link to download Practical File Computer Science Class 12 in Word format by following the below given link:

Download Practical File Practical File Computer Science Class 12 in Word format

Watch this video for more understanding:

Leave a Reply