CLASS XII RECORD PROGRAMS- (2025-26)
1. Write a menu driven program to accept a list of numbers from the user and perform the
following operations.
User defined function
( a) Palindromes() which takes the list as argument and prints all the palindromes available in the
list and also displays the number of palindromes.
b) mmm() which takes the list of integers as argument and prints the mean, median and mode of
the list of numbers.
The program should invoke the functions to perform the tasks mentioned.
2. Write a program which invokes a user defined function named ShowGrades(S) which takes the
dictionary S as an argument. The dictionary S contains Name : [ Eng, Math, Science] as key :
value pairs. The function displays the corresponding grade obtained by the students according
to the following grading rules:
Average of Eng, Math, Science Grade
>=90 A
<90 but >=60 B
<60 C
For example : consider the following dictionary
S = {“AMIT” : [92, 86, 64], “NAGMA”: [ 65, 42, 43], “DAVID” : [ 92, 90, 88] }
The output should be :
AMIT – B
NAGMA – C
DAVID - A
3. Write a program which uses a user defined function named Puzzle(W,N) which takes the
argument W as an English word and N as an integer and returns the string where every Nth
alphabet of the word W is replaced with an underscore(“_”).
For example : if W contains the word “TELEVISION” and N is 3 then the function should return
the string “TE_EV_SI_N”.
4. Write a menu driven program to accept a list of numbers from the user and perform the
following operations:
Square_List(L) where L is the list of elements passed as arguments to the function. The function
returns another list named SList that stores the squares of all Non-Zero elements of L.
Lsearch(L, ele) where L is the list of elements and ele is the element to be searched. The function
should display the position of the element if it’s present and “not found” if it is not.
5. Write a Python program using functions to create a text file “Story.txt”, read from the text file
“Story.txt” and display those words whose length is less than 4 characters and also display the
number of vowels/consonants/uppercase/lowercase character in the file.
6. Write a Python program using functions which creates a text file “File1.txt” and display the words
separated by #
7. Write a Python program which reads from a text file “Revision.txt” and write those lines to
another file “Exam.txt” which does not have the character ‘a’
8. Write an interactive menu driven program in python using binary file to perform the following
tasks:
a. Write the information of the car like carno,carname,mileage and price onto the
“cars.dat” after creating and opening the file.
b. Read from the file and display all the TOYOTA cars with their price.
9. Write a python program to do the following:
a. Create and 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.
10. Write a python program to update the binary file “Mobile.dat” containing the information about
mobile like modelno, memorycard details and megapixel price. The modelno whose megapixel to
be updated are accepted from the user. Create the file ‘Mobile.dat’ before updating. Also display
the content of the file after updating.
11. Write a program to create a csv file “employee.csv” with details [empid, empname, salary,
design]. Count and display the total number of employees and sum of the salaries of all the
managers.
12. Create a csv file by entering userid and password, read and search the password for a given user
id (create, search and display functions)
13. Write a program to create a csv file “patient.csv” with details [patient id, patient name, disease,
roomno] and display all the details on the screen.(create and display functions.)
14. write an interactive python program using the function Dopush( customer), Do pop( customer)
and Do show ( customer) to push, pop and Display the customer details like customer ID, Name,
Phone, no from the stack of customer.
15. BCCI has created a dictionary containing top player and their runs as key 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 the form
Score= {“kapil”:40, “Sachin”:55, “sarav”: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.
16. Sql 1
17. SQL 2
18. SQL 3
19. SQL 4
20. SQL 5
21. 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 average by 5 for those student who belong to science stream.
iv. Display number of male students who belong to commerce stream.
v. Delete the records of those students whose average <40.
22. Write a program to connect python with MYSQL using database connectivity and perform the
following operations on data in database:
i. Create 2 tables.
Table name – Event with Event Id, eventname, Num Performers , celebrity ID.
Table name – celebrity with celebrity ID, Name, Phone, Feecharged.
ii. Insert the following records in both the tables.
Table: Event
EventID Eventname Num performers Celebrity ID
101 Birthday 10 C102
102 Promotion Party 20 C103
103 Engagement 12 C102
104 Wedding 15 C104
105 Birthday 17 C101
Table: celebrity
Celebrity ID Name Phone Feecharged
C101 Faiz khan 9910195610 200000
C102 Sanjay kumar 8934664481 250000
C103 Neerakhan Kapoor 9811665685 300000
C104 Rena 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.
23. 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, LIC.
ii. Insert 5 records in both the tables by accepting the value of the attributes 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.
24. 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 Sangeetha 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.
******************************************************************