MAHARISHI VIDYA MANDIR GROUP OF SCHOOLS
PRACTICAL SYLLABUS FOR THE ACADEMIC YEAR 2025-2026
STD: XII
SUBJECT: COMPUTER SCIENCE PREPARED ON: 04-04-2025
1. Write an interactive menu driven program in Python using functions to traverse and
search for the student name from a list of students containing student roll number, name
and average.
2. Write an interactive Python program to do the following using functions:
(i) Accept a list of elements and exchange the first half with the second
half of the list.
(ii) Accept a list of strings and display the number of palindrome words present in it.
3. Write an interactive Python program using functions to find the sum of boundary, non-
boundary, left diagonal and right diagonal elements of a nested List A of size M x N.
4. Write an interactive menu driven program in python to accept the detailsof employees
such as employee number, name, Basic ,HRA , DA from user and calculate annual salary of
every employee with deductions like PF and to calculate the net salary(Basic + HRA + DA –
PF)using dictionaries.
5. Create STATIONARY and CONSUMER table with the following specifications and insert
the given data. Implement the following SQL commands on the tables STATIONARY and
CONSUMER.
i) Specification for tables:
Table name : STATIONARY
Attributes: S_ID of type String (Primary Key)
Stationary Name of type String Company
of type String
Price of type int
Table name : CONSUMER
Attributes: C_ID of type String(Primary key)
Consumer Name of type String Address
of type String
S_ID of type String (Foreign Key)
ii) Insert the following data
Table: STATIONARY
S_ID StationaryName Company Price
DP01 Dot Pen ABC 10
PL02 Pencil XYZ 6
ER05 Eraser XYZ 7
PL01 Pencil CAM 5
GP02 Gel Pen ABC 15
Table: CONSUMER
C_ID ConsumerName Address S_ID
01 Good Learner Delhi PL01
06 Write Well Mumbai GP02
12 Topper Delhi DP01
15 Write & Draw Delhi PL02
16 Motivation Bangalore PL01
Write SQL commands for the following statements:
iii. To display distinct Company from STATIONARY.
iv. To display the details of Stationary whose Price is in the range of 8 to15
(Both values included)
v. To display the ConsumerName, Address from table Consumer andCompany and Price from
table Stationary with their correspondingmatching S_ID
6. Consider the following tables WORKER and PAYLEVEL and answer thequestions
that follows:
Table : WORKER
ECODE NAME DESIG PLEVEL DOJ DOB
11 RadheShyam Supervisor P001 2004-09-12 1981-08-23
12 Chandernath Operator P003 2010-02-22 1987-07-12
13 Fizza Operator P003 2009-06-14 1983-10-14
14 Ameen Ahmed Mechanic P002 2006-08-21 1984-03-13
15 Sanya Clerk P002 2005-12-19 1983-06-09
18 Sarsa Supervisor P001 2010-01-20 1982-02-01
Table : PAYLEVEL
PLEVEL PAY ALLOWANCE
P001 26000 12000
P002 22000 10000
P003 12000 6000
Write SQL commands for the following statements:
(i) To display the details of all the WORKERS in descending order of their DOJ.
(ii) To display the NAME and DESIG of those WORKERS whose PLEVEL is
either P001 or P002.
(iii) To display the number of workers whose PAY+ALLOWANCE is more than
30000 for every PLEVEL.
(iv) To increase the ALLOWANCE by 1000 where the pay is greater than
20000.
(v) To display the number of Workers designation wise.
7. Consider the following tables COMPUTER and SALES and answer thequestions
that follows:
Table: COMPUTER
PROD_ID PROD_NAME PRICE COMPANY TYPE
P001 Mouse 200 Logitech Input
P002 Laser Printer 4000 Canon Output
P003 Keyboard 500 Logitech Input
P004 Joystick 1000 Iball Input
P005 Speaker 1200 Creative Output
P006 Deskjet Printer 4300 Canon Output
Table:SALES
PROD_ID QTY_SOLD QUARTER
P002 4 1
P003 2 2
P001 3 2
P004 2 1
Write SQL commands for the following statements:
i) Display the minimum price and maximum price from the table COMPUTER.
ii) Display the total number of records company wise, when the count is greater
than 1.
iii) Add a Constraint PRIMARY KEY to the column PROD_ID in the tableCOMPUTER
iv) Display the product details and quantity sold for the first quarter usingnatural
join.
v) Increase the price of the products by 100 for input type products.
8. Consider the following tables TOYSHOP and SUPPLIERS and answer thequestions
that follows:
Table:TOYSHOP
SNO NAME SCODE QUANTITY PRICE TYPE
T005 Ball H22 20 450 HF
T003 Ludo P101 60 200 GF
T004 Stuffed Panda G204 40 650 TF
T006 Monopoly S222 70 780 GF
T001 Tennis Raquet R402 40 1150 GF
T007 Train Tracks A101 85 990 HF
T002 Singing Doll R402 25 470 GF
Table:SUPPLIERS
SCODE SNAME
H222 Rohan Kumar
P101 Vijay Pal
G204 Garv Punaya
R402 Ritwij Rawat
Write SQL commands for the following statements:
i. To display the highest price of each type of toy.
ii. To display the toys which are supplied by Ritwij Rawat
iii. To display the total quantity of toys supplied by each supplier.
iv. To display the name of the supplier who supplies Tennis Raquets.
v. To add a new column, Date of Order of the type date to the table TOYSHOP
9. Consider the following tables SPORTS and COACH and answer the questionsthat
follows:
TABLE : SPORTS
Scode Sportsname Participants Prizemoney Scheduledate
101 Carrom 2 5000 2012-01-23
102 Badminton 2 12000 2011-12-12
103 Table Tennis 4 8000 2012-02-14
105 Chess 2 9000 2012-01-01
108 Lawn Tennis 4 25000 2012-03-19
TABLE : COACH
Code Name Scode
1 Ravi 101
2 Mohan 108
3 Sameer 101
4 Shikhar 103
Write SQL commands for the following statements:
(i) To display scode, the number of coaches for each scode from the tablecoach and display
scode in descending order.
(ii) To display details of those sports and coachname which are having
Prizemoney more than 9000 and coachname ends with ‘n’.
(iii) To display the contents of the sports table with their coachname whose
schedule date is in the year 2012.
(iv) To display number of different participants from the table sports.
(v) Delete the column Prizemoney from the table SPORTS.
10. Write a Program to connect Python with MySQL using database connectivity and perform
the following operations on data in database: Insert,Fetch and Update the data.
i) Create a table Teacher with Teacher ID, Name, Age, Department, Doj,Salary,
Gender, Place.
Table - TEACHER
T_id Name Age Department Date_of_join Salary Gender Place
1 Jugal 34 Computer 10/01/2017 12000 M Delhi
Science
2 Sharmila 31 History 24/03/2008 20000 F Raipur
3 Sandeep 32 Mathematics 12/12/2016 30000 M Delhi
4 Sangeeta 35 History 01/07/2015 40000 F Chennai
5 Rakesh 42 Mathematics 05/09/2007 25000 M Delhi
ii) Insert the above records into the TEACHER Table.
iii) Display the records of the Teachers who belong to “Delhi”.
iv) Update the salary for the Teachers by 10% who have joined in the year 2017 and
2018.
v) Display the highest salary being paid in each department
11. Write a program to connect Python with MySQL using database connectivity and perform
the following operations on data in database: Insert,Fetch, Update and Delete the data.
(i) Create a table Student with admno, sname, gender, dob, stream, average.
(ii) Insert 5 records into the student table by accepting from the user.
(iii) Increase the marks by 5 for those students who belong to science
stream.
(iv) Display the number of male students who belong to commerce stream.
(v) Delete the records of those students whose average<40.
12. Write a program to connect Python with MySQL using database connectivity and perform
the following operations on data in database: Fetch, Update and Delete the data.
(i) Create 2 tables
● Table name - Event with EventId, Eventname, NumPerformers,CelebrityID.
● Table name – Celebrity with CelebrityID, Name, Phone, FeeCharged
(ii) Insert the following records in both the tables.
Table : Event
EventId Eventname NumPerformers CelebrityID
101 Birthday 10 C102
102 Promotion Party 20 C103
103 Engagement 12 C102
104 Wedding 15 C104
105 Birthday 17 C101
Table : Celebrity
CelebrityID Name Phone FeeCharged
C101 Faiz Khan 9910195610 200000
C102 Sanjay Kumar 8934664481 250000
C103 NeeraKhan Kapoor 9811665685 300000
C104 Reena Bhatia 6587775645 100000
(iii) Display the Eventname, Name of celebrity and Feecharged for those celebrities
who charge more than 200000
(iv) Increase the Feecharged by 10,000 for the events whose number of
Performers is > 15
(v) Delete the records of those Celebrity whose name starts with R.
13. Write a program to connect Python with MySQL using database connectivity and perform
the following operations on data in database: Fetch, Update and Delete the data.
(i) Create 2 tables
● Table name - Employee with Empno, Name, Desig, Salary, Leave, Bonus.
● Table name – Insurance with Empno, LICAmt
(ii) Insert 5 records in both the tables by accepting the values of theattributes from
the user.
(iii) Display the total salary of each designation of those employees whose
name starts with ‘R’.
(iv) Display the Employee Number and Name who has the LIC insurance.
(v) Update the salary by 10% for those employees whose designation is Clerk.
14. Write a Python program using functions to create a text file“Replace.txt”, read lines from
the text file “Replace.txt” and copy all the lines that contain the character 'a' from the file and
write it to another file called “New.txt”.
15. Write a Python program using functions to create a text file “Story.txt”, read lines from
the text file “Story.txt” and display those words whose length is less than 4 characters.
16. Write a Python program using functions to count the number of words starting with the
vowel in a file Books.txt
17. Write a Python program which has the function to read from the file Exam.txt and display
all the lines which ends with the word “health”.
18. Write an interactive menu driven Python program using binary file to perform the following
tasks:
a. Write the information of the car like CarNo, Carname, Mileage and
Price onto the file “CARS.DAT”
b. b. Read from the file and display all the “Toyota cars” with their price.
19. Write a Python program using user defined functions to update the binary file
“Mobile.DAT” containing the information about mobile like ModelNo, memorycard, Modelname
and megapixel. The Modelno whose megapixel to be updated are accepted from the user.
20. Write a Python program to do the following :
a. Write the information of the directory details like name, address,
areacode and phone number on to the binary file “Telephone.DAT”
b. Delete all the records where the areacode is “TP101”.
c. Read from the file and display the details of all the records and also
to count the number of records present in it.
21. Write an interactive Python program using functions to perform the writing operation
onto the csv file “Student.csv”. The details to be written are Rno, Name, Marks in 5 subjects
and Average. Read from the “Student.csv” fileand display the details of those students whose
Average is above 85.
22. Write a Python program using functions to write the details of Employee on to the file
“Emp.csv” which has the following: Eno, Name, Designation, Department and Salary. Read
from the file and display the Name and Salaryof the Managers who belong to Sales
department.
23. Write an interactive menu driven program using the following user defined
functions to perform given operations on the stack named ‘Record’:
(i) Push_record(Student) – To pass the list Student = [ ['Rahul', 12,'Delhi'],
[‘Kohli',11,'Mumbai'], ['Rohit',12,'Delhi'] ] as argument and then Push an
object containing Student name, Class and City of student who belongs to
‘Delhi’ to the stack Record and return the contents of stack
(ii) Pop_record(Record) – To pass the stack Record [[“Rohit”,”12”,”Delhi”]
[“Rahul”,12,”Delhi”] ] and then to Pop all the objects from the stack and at
last display “Stack Empty” when there is no student record in the stack.
(iii) Display_record(Record) – To pass the stack Record and display all the
objects.
24. BCCI has created a dictionary containing top players and their runs askey value
pairs of a cricket team. Write an interactive Python program using the functions
Push(), Pop_and_Display() to do the following operations:
i) Push() - Push the keys (name of the players) from the dictionary of theform
SCORE={"KAPIL":40, "SACHIN":55, "SAURAV":80, "RAHUL":35, "YUVRAJ":110,
} into the stack, where the corresponding value (runs) is greater than 49.
ii) Pop_and_Display()- To delete the Players name from the stack and display it