Computer Science Practical File
Code No. 083
CLASS XII
Session: 2024-25
Submitted By: Submitted To:
Name: Ms. Madhulika Pandey
Class&Sec: Computer Science Teacher
Student Id:
CBSE Roll No:
Index
S.No List Of Practicals Page No.
1 Read a text file line by line and display each word separated by a #.
2 Read a text file and display the number of
vowels/consonants/uppercase/lowercase characters in the file.
3 Remove all the lines that contain the character 'a' in a file and write it to
another file
4 Create a binary file with name and roll number. Search for a given roll
number and display the name, if not found display appropriate message.
5 Create a binary file with roll number, name and marks. Input a roll
number and update the marks.
6 Write a random number generator that generates random numbers
between 1 and 6 (simulates a dice).
7 Write a Python program to implement a stack using list
8 Create a CSV file by entering user-id and password, read and search the
password for given userid.
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
10 UPDATE table to modify data
11 ORDER By to display data in ascending / descending order
12 DELETE to remove tuple(s)
13 GROUP BY and find the min, max, sum, count and average
14 Create table student inside database “School” using python
15 Insert multiple records in a table using python interface
16 To display all records of table using python interface
17 Search a record using string template with %s formatting
18 Search a record using string template with {} and format fiunction
19 Delete record from table for roll no. using python interface
20 Write a code to connect to a Mysql database namely School and then
fetch all those records from table Student where grade is ‘A’.
PROGRAM 1
AIM: Read a text file line by line and display each word separated by a
#.
SOURCE CODE:
OUTPUT:
PROGRAM 2
AIM: ● Read a text file and display the number of
vowels/consonants/uppercase/lowercase characters in the file.
SOURCE CODE:
OUTPUT:
PROGRAM 3
AIM: Remove all the lines that contain the character 'a' in a file and
write it to another file
SOURCE CODE:
OUTPUT:
PROGRAM 4
AIM: Create a binary file with name and roll number. Search for a
given roll number and display the name, if not found display
appropriate message
SOURCE CODE:
OUTPUT:
PROGRAM 5
AIM: Create a binary file with roll number, name and marks. Input a
roll number and update the marks.
SOURCE CODE:
OUTPUT:
PROGRAM 6
AIM: Write a random number generator that generates random
numbers between 1 and 6 (simulates a dice).
SOURCE CODE:
OUTPUT:
PROGRAM 7
AIM: Write a Python program to implement a stack using list.
SOURCE CODE:
OUTPUT:
PROGRAM 8
AIM: Create a CSV file by entering user-id and password, read and
search the password for given userid.
SOURCE CODE:
OUTPUT:
PROGRAM 9
AIM: 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
SOURCE CODE:
OUTPUT:
PROGRAM 10
AIM: Create a student table and insert data. Implement the following
SQL commands on the student table: UPDATE table to modify data
SOURCE CODE:
OUTPUT:
PROGRAM 11
AIM: Create a student table and insert data. Implement the following
SQL commands on the student table:ORDER By to display data in
ascending / descending order
SOURCE CODE:
OUTPUT:
PROGRAM 12
AIM: Create a student table and insert data. Implement the following
SQL commands on the student table: DELETE to remove tuple(s)
SOURCE CODE:
OUTPUT:
PROGRAM 13
AIM: Create a student table and insert data. Implement the following
SQL commands on the student table: GROUP BY and find the min,
max, sum, count and average
SOURCE CODE:
OUTPUT:
PROGRAM 14
AIM: Create table student inside database “School” using python
SOURCE CODE:
(Preeti Arora Practical Implementation No 4)
OUTPUT:
PROGRAM 15
AIM: Insert multiple records in a table using python interface
SOURCE CODE:
Preeti Arora Practical Implementation No 9
OUTPUT:
PROGRAM 16
AIM: To display all records of table using python interface
SOURCE CODE:
Preeti Arora Practical Implementation No 10
OUTPUT:
PROGRAM 17
AIM: Search a record using string template with %s formatting
SOURCE CODE:
Preeti Arora Page No 8.20 (b) part
OUTPUT:
PROGRAM 18
AIM: Search a record using string template with {} and format
function
SOURCE CODE:
Preeti Arora Page No 8.21 © part
OUTPUT:
PROGRAM 19
AIM: Delete record from table for roll no. using python interface
SOURCE CODE:
Preeti Arora Practical Implementation 16
OUTPUT:
PROGRAM 20
AIM: Write a code to connect to a Mysql database namely School and
then fetch all those records from table Student where grade is ‘A’.
SOURCE CODE:
Preeti Arora Solved Question 15
OUTPUT: