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:
- Working with functions
- Exception Handling
- Data File Handling
- Data Structure
- Database Management (MySQL)
- 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:
|1||1. Python program(60% Logic + 20% documentation + 20% code quality)|
2. SQL queries (4 queries based on one or two tables)
|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
|3||Project (using concepts learnt in Classes 11 and 12)||8|
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.
- 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.
- 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.
- Write a Python program using a function to print factorial number series from n to m numbers.
- 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.
- 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:
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
- Write a Python program to accept a list as a function parameter and raise the IndexError exception.
- 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
- Create a text file “intro.txt” in Python and ask the user to write a single line of text by user input.
- 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.
- Write a program to replace all spaces from text with – (dash) from the file intro.txt.
- 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:
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
- 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.
- 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
- 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:
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
 Read a CSV file top5.csv and print the contents in a proper format. The data for the top5.csv file are as follows:
|1||K L Rahul||KXI||670||132*|
 Read a CSV file students.csv and print them with a tab delimiter. Ignore the first-row header to print in tabular form.
 Write records of students into result.csv. The fields are as follows:
|Field 1||Data Type|
Programs based on data structure stack
- Write a menu-driven Python program to implement stack operation.
- 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)
 Consider the following MOVIE table and write the SQL queries based on it.
- Display all information from movie.
- Display the type of movies.
- 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.
- Display movieid, moviename and productioncost for all movies with productioncost greater thatn 150000 and less than 1000000.
- Display the movie of type action and romance.
Queries set 2 (Aggregate Functions)
Consider the given table patient and Write following queries:
- Display the total charges of patients admitted in the month of November.
- Display the eldest patient with name and age.
- Count the unique departments.
- 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:
- Create a database “Sports”.
- 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.
- Now create another table MATCH_DETAILS and insert data as shown below. Choose appropriate data types and constraints for each attribute.
Queries set 4 (Based on Two Tables)
- Display the matchid, teamid, teamscore who scored more than 70 in the first inning along with team name.
- Display matchid, teamname and secondteamscore between 100 to 160.
- Display matchid, teamnames along with matchdates.
- Display unique team names
- 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:
- Display all the items in the ascending order of stockdate.
- Display maximum price of items for each dealer individually as per dcode from stock.
- Display all the items in descending orders of itemnames.
- Display average price of items for each dealer individually as per doce from stock which avergae price is more than 5.
- Diisplay the sum of quantity for each dcode.
Programs based on Python – MySQL Connectivity
- 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
- Perform all the operations with reference to table ‘students’ through MySQL-Python connectivity.
- Write a menu-driven program to store data into a MySQL database named shop and table customer as following:
- Add customer details
- Update customer details
- Delete customer details
- Display all customer details
- Modify the above program and display the customer details based on the following menu:
- Display customer details by city
- Display customer details by bill amount
- Display customer details by name
- 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:
Follow this link to download Practical File Computer Science Class 12 in Word format by following the below given link:
Watch this video for more understanding: