You are on page 1of 38

SHRIKANWARTARA PUBLIC HIGHER SECONDARY

SCHOOL, MANDLESHWAR

AISSCE PRACTICAL EXAM 2022-23


XII-COMPUTER SCIENCE
(PRACTICAL LIST as per CBSE Curriculum)
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. 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.
4. Create a binary file with roll number, name and marks. Input a roll number and
update the marks.
5. Remove all the lines that contain the character `a' in a file and write it to another
file.
6. Write a random number generator that generates random numbers between 1
and 6 (simulates a dice).
7. Create a CSV file by entering user-id and password, read and search the
password for given user-id.
8. Read a text file to count the words ‘this’ and ‘that’ present in a text file.
9. Read lines from a text file INDIA.txt, to find and display the occurrence of the
word “India”.
10. Read lines from a text file MYNOTES.txt, and display those lines which are
starting with an alphabet ‘T’.
11. Write a Python program to implement a stack using list.
12. Write a program to write the student details in a csv file student.csv
13. Write a program to search the details of a student from the file student.csv
14. Write a python program to accept username “Admin” as default argument and
password 123 entered by user to allow login into the system.
15. Write a program to display those words which are exactly having 4 characters.

Mr. Raja Chouhan


PGT Computer Science Page | 1
16. Queries Set 1 (Database Fetching records)
17. Queries Set 2 (Based on Functions)
18. Queries Set 3 (DDL Commands)
19. Queries set 4 (Based on Two Tables)
20. Queries Set 5 (Group by, Order By)
21. Integrate SQL with Python by importing the MySQL module record of
employee and display the record.
22. Integrate SQL with Python by importing the MySQL module to search an
employee using empno and if present in table display the record, if not display
appropriate message.
23. Integrate SQL with Python by importing the MySQL module to search a
student using rollno, update the record.
24. Integrate SQL with Python by importing the MySQL module to search a
student using rollno, delete the record.

Mr. Raja Chouhan


PGT Computer Science Page | 2
1. Read a text file line by line and display each word separated by a #.

OUTPUT :

TEXT FILE :

Mr. Raja Chouhan


PGT Computer Science Page | 3
2. Read a text file and display the number of vowels/ consonants/
uppercase/ lowercase characters in the file.

OUTPUT :

TEXT FILE :

Mr. Raja Chouhan


PGT Computer Science Page | 4
3. 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.

Mr. Raja Chouhan


PGT Computer Science Page | 5
OUTPUT :

Mr. Raja Chouhan


PGT Computer Science Page | 6
4. Create a binary file with roll number, name and marks. Input a roll
number and update the marks.

Mr. Raja Chouhan


PGT Computer Science Page | 7
OUTPUT :

Mr. Raja Chouhan


PGT Computer Science Page | 8
5. Remove all the lines that contain the character `a' in a file
and write it to another file.

TextFile 1 :

TextFile 2 :

Mr. Raja Chouhan


PGT Computer Science Page | 9
6. Write a random number generator that generates random
numbers between 1 and 6 (simulates a dice).

OUTPUT :

Mr. Raja Chouhan


PGT Computer Science Page | 10
7. Create a CSV file by entering user-id and password, read and
search the password for given user-id.

Mr. Raja Chouhan


PGT Computer Science Page | 11
OUTPUT :

CSV File:

Mr. Raja Chouhan


PGT Computer Science Page | 12
8. Read a text file to count the words ‘this’ and ‘that’ present in a text
file.

OUTPUT :

TEXT FILE:

Mr. Raja Chouhan


PGT Computer Science Page | 13
9. Read lines from a text file INDIA.txt, to find and display the
occurrence of the word “India”.

OUTPUT :

TEXT FILE :

Mr. Raja Chouhan


PGT Computer Science Page | 14
10. Read lines from a text file MYNOTES.txt, and display those lines
which are starting with an alphabet ‘T’.

OUTPUT :

TEXT FILE :

Mr. Raja Chouhan


PGT Computer Science Page | 15
11. Write a Python program to implement a stack using list.

Mr. Raja Chouhan


PGT Computer Science Page | 16
Mr. Raja Chouhan
PGT Computer Science Page | 17
OUTPUT :

Mr. Raja Chouhan


PGT Computer Science Page | 18
Mr. Raja Chouhan
PGT Computer Science Page | 19
12. Write a program to write the student details in a csv file student.csv

OUTPUT :

CSV File:

Mr. Raja Chouhan


PGT Computer Science Page | 20
13. Write a program to search the details of a student from the file
student.csv

OUTPUT :

Mr. Raja Chouhan


PGT Computer Science Page | 21
14. Write a python program to accept username “Admin” as default
argument and password 123 entered by user to allow login into the
system.

OUTPUT :

Mr. Raja Chouhan


PGT Computer Science Page | 22
15. Write a program to display those words which are exactly having 4
characters.

OUTPUT :

TEXT FILE:

Mr. Raja Chouhan


PGT Computer Science Page | 23
16. Queries Set 1 (Database Fetching records)
Consider the following MOVIE table and write the SQL queries based on it.

a) Display all information from movie.

b) Display the type of movies.

c) Display movieid, moviename, total_earning by showing the business done by


the movies. Calculate total_earning using the sum of productioncost and
businesscost.

Mr. Raja Chouhan


PGT Computer Science Page | 24
d) Display movieid, moviename and productioncost for all movies with
productioncost greater than 150000 and less than 1000000.

e) Display the movie of type action and romance.

f) Display the list of movies which are going to release in February, 2022.

Mr. Raja Chouhan


PGT Computer Science Page | 25
17. Queries Set 2 (Based on Functions)
Write following queries:
a) Write a query to display cube of 5.

b) Write a query to display the number 563.854741 rounding off to the next
hundred.

c) Write a query to display "put" from the word "Computer".

d) Write a query to display today's date into DD.MM.YYYY format.

e) Write a query to display 'DIA' from the word "MEDIA".

Mr. Raja Chouhan


PGT Computer Science Page | 26
f) Write a query to display moviename - type from the table movie.

g) Write a query to display first four digits of productioncost.

Mr. Raja Chouhan


PGT Computer Science Page | 27
18. 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 Tehlka, Team Toofan, Team Aandhi and
Team Shailab. During summer vacations, various matches will be conducted
between these teams. Help your sports teacher to do the following:
a) Create a database “Sports”.

b) Create a table “TEAM” with following considerations:


i) It should have a column TeamID for storing an integer value between 1
to 9, which refers to unique identification of a team.
ii) Each TeamID should have its associated name (TeamName), which
should be a string of length not less than 10 characters.
iii) Using table level constraint, make TeamID as the primary key.

c) Show the structure of the table TEAM using a SQL statement.

d) As per the preferences of the students four teams were formed as given below.
Insert these four rows in TEAM table:
a. Row 1: (1, Tehlka)
b. Row 2: (2, Toofan)
c. Row 3: (3, Aandhi)
Mr. Raja Chouhan
PGT Computer Science Page | 28
d. Row 3: (4, Shailab)

e) Show the contents of the table TEAM using a DML statement.

f) Now create another table MATCH_DETAILS and insert data as shown below.
Choose appropriate data types and constraints for each attribute.

Mr. Raja Chouhan


PGT Computer Science Page | 29
Mr. Raja Chouhan
PGT Computer Science Page | 30
19. Queries set 4 (Based on Two Tables)
Write following queries:
a) Display the matchid, firstteamid, teamname, firstteamscore who scored more
than 70 in first inning along with team name.

b) Display firstteamid, teamname.

c) Display matchid, teamname and secondteamscore between 100 to 160.

Mr. Raja Chouhan


PGT Computer Science Page | 31
d) Display unique team names from firstteamid.

e) Display matchid and matchdate played by Anadhi and Shailab.

Mr. Raja Chouhan


PGT Computer Science Page | 32
20. Queries Set 5 (Group by, Order By)
Consider the following table and write the queries:

a) Display all the items in the ascending order of stockdate.

b) Display maximum price of items for each dealer individually as per dcode from
stock.

Mr. Raja Chouhan


PGT Computer Science Page | 33
c) Display all the items in descending orders of itemnames.

d) Display average price of items for each dealer individually as per dcode from
stock which average price is more than 5.

e) Display the sum of quantity for each dcode.

Mr. Raja Chouhan


PGT Computer Science Page | 34
21. Integrate SQL with Python by importing the MySQL module record
of employee and display the record.

OUTPUT:

Mr. Raja Chouhan


PGT Computer Science Page | 35
22. Integrate SQL with Python by importing the MySQL module to
search an employee using empno and if present in table display the
record, if not display appropriate message.

OUTPUT:

Mr. Raja Chouhan


PGT Computer Science Page | 36
23. Integrate SQL with Python by importing the MySQL module to
search a student using rollno, update the record.

OUTPUT:

Mr. Raja Chouhan


PGT Computer Science Page | 37
24. Integrate SQL with Python by importing the MySQL module to
search a student using rollno, delete the record.

OUTPUT :

Mr. Raja Chouhan


PGT Computer Science Page | 38

You might also like