You are on page 1of 7

CLASS : XII

COMPUTER SCIENCE
PRACTICAL PROGRAM LIST 2021-2022
TERM - I
1. Write an interactive menu driven program to apply linear and binary
search for a list of strings using functions.
2. Write a Python program using function to sort the details of Doctors
in descending order of their specialization using bubble sort. The
Doctors detail includes DoctorId, Name and specialization which is
stored as a nested list.
3. Write a Python program which has the function to sort the details of
the Products in ascending order of their price using insertion sort.
The nested list contains the details of the Product such as Pid,
Pname, Qty and price.
4. Write a Python program using function to count the number of words
starting with the vowel in a file Books.txt
5. 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”.
6. Write a Python program which has the function to read a text file
and display the number of vowels/consonants/uppercase/lowercase
characters in the file.
7. Write a Python program using functions to read from the text file
“Notes.txt” and do the following:
(i) Display the occurrences of the word “this” in the file.
(ii) Write all the lines which starts with ‘A’ on to the file
newfile.txt.
8. Write a Python program using binary file to perform the following
tasks:
(i) Write the information of the car like CarNo,Carname, mileage
and price onto the “CARS.DAT”
(ii) Read from the file and display all the Toyota cars with their
price.
9. Write a Python program to do the following :
(i) Write the information of the directory details like name,
address, areacode and phone number on to the binary file
Telephone.DAT
(ii) Delete all the records where the areacode is “TP101”.
(iii) 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 an interactive program using functions to enter the
following records in a binary file:”ITEM.DAT” [Item No, Item_Name,
Qty, Price] Number of records to be entered should be accepted
from the user. Read the file to display the total value of stock. Value
of each item to be calculated as Price * Qty.
11. Write a Python program to update the binary file “Mobile.dat”
containing the information about mobile like ModelNo, memorycard,
details and megapixel. The Modelno whose megapixel to be updated
are accepted from the user.
12. Write an interactive Python program to perform the writing
operation on to the csv file “Student.csv”. The details to be written
are Rno, Name, Marks in 5 subjects and Average. Read from the
Student.csv file and display the details of those students whose
Average is above 85.
13. 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 Salary of the Managers who belong to Sales
department.
14. Write a Python program using functions to do the following :
(i) Generate Fibonacci series
(ii) To check whether the passed number is Armstrong or not
15. Write a Python program using functions to do the following :
(i) SHIFT(lst) that would accept a list as argument. The function
should shift the negative numbers of the list to right and the
positive numbers to left without using another list.
(ii) FIRSTHALF(lst) that would shift the first half elements with
the second half of the list.
TERM - II
16. Write an interactive Python program to find the sum of
boundary, non-boundary, left diagonal and right diagonal elements
of a nested List A of size MxN.
17. Write an interactive Python program using the functions
DoPush(Customer), DoPop(Customer) and DoShow(Customer) to
push,pop and display the Customer details like Customer ID, Name,
Phone no from the Stack of Customers.
18. Consider the following tables WORKER and PAYLEVEL and
answer the questions 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.
19. Consider the following tables SPORTS and COACH and answer
the questions that 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 table coach 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 2019.
(iv) To display number of different participants from the table
sports.
(v) Increase the Participants by 6 for the sports carom, chess
and badminton.

20. Consider the following tables SPORTS and COACH and answer
the questions that follows:
TABLE :COMPANY

Cid Name City ProductName


111 Sony Delhi TV
222 Nokia Mumbai Mobile
333 Onida Delhi TV
444 Sony Mumbai Mobile
555 BlackBerry Madras Mobile
666 Dell Delhi Laptop
TABLE :CUSTOMER

Custid Name Price Qty Cid


101 Rohan Sharma 70000 20 222
102 Deepak 50000 10 666
Kumar
103 Mohan Kumar 30000 5 111
104 SahilBansal 35000 3 333
105 NehaSoni 25000 7 444
106 SonalAggarwal 20000 5 333
107 Arjun Singh 50000 15 666

i) To display those company name which are having prize


less than 30000.
ii) To display the name of the companies in reverse
alphabetical order.
iii) To increase the prize by 1000 for those customer whose name
starts with ‘S’.
iv) To add one more column totalprice with decimal(10,2) to the
table customer.
v) Display the product name, city, price where the productname is
mobile.

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 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.
22. 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 5 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 8934664481 250000


Kumar

C103 Neera Khan 9811665685 300000


Kapoor

C104 Reena 6587775645 100000


Bhatia

(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 values 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 with the number 50000.
(v) Update the salary by 10% for those employees whose
designation is Clerk.

***********

You might also like