0% found this document useful (0 votes)
92 views29 pages

Class 12 CS Practical File Session 2025-26

practical file

Uploaded by

sarbanagrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views29 pages

Class 12 CS Practical File Session 2025-26

practical file

Uploaded by

sarbanagrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 29

Vrindavan Public

School Vrindavan
ACADEMIC YEAR 2025-26
COMPUTER SCIENCE
PRACTICAL FILE

SUBMITTED BY : SUBIMMITED TO:


NAME : AMIT SIR
CLASS : XII
ROLL NO.:
SUBJECT CODE: 083
Q-1 Read a text file line by line and display each word separated by a #.
Ans-1
Q-2 Read a text file and display the number of vowels / consonants / uppercase /
lowercase characters in the 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

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

#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:

print("error connecting to database")

cursor=mycon.cursor()

cursor.execute("select *from student”)

data=cursor.fetchall()

for i in data:

print(i)

mycon.close()

Q-11:Integrate SQL with Python by importing the pymysql module

Ans-11

importpymysql as pym

mycon=sqltor.connect(host="localhost",user="root",passwd="tiger",database="
gvkcv")

cursor=mycon.cursor()

cursor.execute("select *from student10")

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy