Class 12 CS Practical File Session 2025-26
Class 12 CS Practical File Session 2025-26
School Vrindavan
ACADEMIC YEAR 2025-26
COMPUTER SCIENCE
PRACTICAL FILE
Ans-2
Q-3Remove all the lines that contain the character a in a file and write it to
another file.
Ans-3
Q-4Create a binary file with roll number, name and marks. Input a roll number
and update the marks.
Ans-4
Q-5Create a binary file with name and roll number. search for a given roll
number and display the name if not found display appropriate message.
Ans-5
Q-6Write a random number generator that generates random numbers #between
1 and 6 (simulates a dice).
Ans-6
Q-7 Write a python program to implement a stack using a list data-structure.
Ans-7
Q-8Create a csv file by entering user id and password read and search the
password for given user id.
Ans-8
Q-9 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
GROUP BY and find the min, max, sum, count and average
#Switched to a database
Q-10:Integrate SQL with Python by importing the MySQL module
A-10
importmysql.connector as sqltor
mycon=sqltor.connect(host="localhost",user="root",passwd="tiger",database="
gvkcv")
ifmycon.is_connected()==False:
cursor=mycon.cursor()
data=cursor.fetchall()
for i in data:
print(i)
mycon.close()
Ans-11
importpymysql as pym
mycon=sqltor.connect(host="localhost",user="root",passwd="tiger",database="
gvkcv")
cursor=mycon.cursor()
data=cursor.fetchall()
for i in data:
print(i)
mycon.close()
Q-12 Perform all the operations with reference to table ‘students’ through
MySQL-Python connectivity.
Ans-12