Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

MAHARISHI VIDYA MANDIR SR. SEC.

SCHOOL
CLASS : XII
COMPUTER SCIENCE
PRACTICAL PROGRAM LIST
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 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.
5. Write a Python program using function to count the number
of words starting with the vowel in a file Books.txt
6. 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”.
7. Write an interactive menu driven 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.
8. 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.
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 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.
11. 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.
12. 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.
13. 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.
14. 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.

15. Write an interactive Python program using the functions


InsQueue(Passenger), DelQueue(Passenger),
DispQueue(Passenger) to add, delete and display the Passenger
details like Passenger name and ticketno.

16. 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.

17. 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.

18. 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.
19. 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 20 C103


Party

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 9811665685 300000


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

You might also like