AMICUS INTERNATIONAL SCHOOL, BHARUCH
SUBJECT: COMPUTER SCIENCE (083)
PRACTICAL LIST (2023-24)
CLASS: XII SCIENCE
1) Write a user defined function to find a factorial of a natural number.
2) Write a function, lenWords(STRING), that takes a string as an argument and returns a tuple
containing length of each word of a string. For example, if the string is:"I am proud of my country",
the tuple will have:(1, 2, 5, 2, 2, 7)
3) Write a function change ( ), to double the even elements and triple the odd elements present in a list.
The function will take and list as parameter and also return the list.
4) Write a method in python to find and display the prime numbers between 2 to N. Pass N as
argument to the method.
5) Write a program with user- defined function with string as a parameter which replaces all vowels in
the string with ‘*’.
6) Write a program using the function to print the Fibonacci series up to n numbers.
7) Write a menu driven program using different functions for the following menu:
1. Check no. is Palindrome or not
2. Check no. is Armstrong or not
3. Exit
8) Write a python program to read a file named “article.txt”, count and print the following:
(i) total alphabets (ii) total upper case alphabets (iii) total lower case alphabets
(iv) total digits (v) total spaces (vi) total special characters
9) Read a text file line by line and display each word separated by ‘@’.
10) Write a method in python to read lines from a text file INDIA.TXT, to find and display the
occurrence of the word ‘India’.
For Example:
If the content of the file is
“India is the fastest growing economy.
India is looking for more investments around the globe.
The whole world is looking at India as a great market.
Most of the Indians can foresee the heights that India is capable of reaching.”
11) Program to read, count and display those lines from the text file that starts with alphabet ‘K’.
12) Write method/function DISPLAYWORDS ( ) in python to read lines from a text file poem.txt and
display those words which are less than 4 characters.
13) Write user defined functions to perform read and write operations onto a ‘student.csv’ file having
fields roll number, name, stream and marks.
14) Write a function in python PUSH(Arr), where Arr is a list of numbers. From this list, push all the
numbers divisible by 5 into stack implemented by using a list. Display the stack if it has at least one
element otherwise display appropriate error message.
15) Write a function search ( ) to search a record in a binary file according to the student number
entered by the user. Also display the message “Record not found” in case record not found in the
file.
16) Write a menu driven program to display read, modify and delete the record in a binary file.
17) Write a python program using function POP (Arr), where Arr is a stack implemented by a list of
numbers. The function returns the value deleted from the stack.
18) Create a CSV file by entering user -id and password, read and search the password for given user -
id.
19) ABC school is managing student data in student table in the school database. Write a python code
that connects to database school and displays the record of total number of students.
20) Write python mysql connectivity program to retrieve all the data from student table.
21) 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
Titan, Team Rockers, Team Magnet and Team Hurricane. 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:
1. It should have a column TeamID for storing an integer value between 1 to 9, which refers to
unique identification of a team.
2. Each TeamID should have its associated name (TeamName), which should be a string of
length not less than 10 characters.
(c) Using table level constraint, make TeamID as the primary key.
(d) Show the structure of the table TEAM using a SQL statement.
(e) As per the preferences of the students four teams were formed as given below.
Insert these four rows in TEAM table:
Row 1: (1, Team Titan)
Row 2: (2, Team Rockers)
Row 3: (3, Team Magnet)
Row 4: (4, Team Hurricane)
(f) Show the contents of the table TEAM using a DML statement.
(g) Now create another table MATCH_DETAILS and insert data as shown below. Choose
appropriate data types and constraints for each attribute.
Table: MATCH_DETAILS
Match FirstTeam SecondTeam FirstTeam SecondTeam
MatchDate
ID ID ID Score Score
M1 2018-07-17 1 2 90 86
M2 2018-07-18 3 4 45 48
M3 2018-07-19 1 3 78 56
M4 2018-07-19 2 4 56 67
M5 2018-07-18 1 4 32 87
M6 2018-07-17 2 3 67 51
22) Consider the following table named "Product", showing details of products being sold in a
grocery shop.
PCode PName UPrice Manufacturer
P01 Washing Powder 120 Surf
P02 Toothpaste 54 Colgate
P03 Soap 25 Lux
P04 Toothpaste 65 Pepsodent
P05 Soap 38 Dove
P06 Shampoo 245 Dove
Write SQL queries for the following:
(a) Create the table Product with appropriate data types and constraints.
(b) Identify the primary key in Product.
(c) List the Product Code, Product name and price in descending order of their product name. If
PName is the same, then display the data in ascending order of price.
(d) Add a new column Discount to the table Product.
(e) Calculate the value of the discount in the table Product as 10 per cent of the UPrice for all those
products where the UPrice is more than 100, otherwise the discount will be 0.
(f) Increase the price by 12 per cent for all the products manufactured by Dove.
(g) Display the total number of products manufactured by each manufacturer.
Write the output(s) produced by executing the following queries on the basis of the information
given above in the table Product:
(h) SELECT PName, avg(UPrice) FROM Product GROUP BY Pname;
(i) SELECT DISTINCT Manufacturer FROM Product;
(j) SELECT COUNT (DISTINCT PName) FROM Product;
(k) SELECT PName, MAX(UPrice), MIN(UPrice) FROM Product GROUP BY PName;
23) Study the following tables DOCTOR and SALARY and write SQL commands for the questions
(i) to (v).
(i) Display NAME of all doctors who are in MEDICINE department having more than 10yrs
experience from the table DOCTOR.
(ii) Display the average salary of all doctors working in ENT department using the tables DOCTOR
and SALARY. SALARY = BASIC + ALLOWANCE.
(iii) Display the minimum ALLOWANCE of female doctors.
(iv) Display the highest consultation fee among all male doctors.
(v) To display the detail of doctor who have experience more than 12 years.
24) Create an Employee Table with the fields Empno, Empname, Desig, Dept, Age and Place. Enter five
records into the table
• Add two more records to the table.
• Modify the table structure by adding one more field namely date of joining.
• Check for Null value in doj of any record.
25) Write a python program to integrate MYSQL with Python by inserting records to EMP table and
displaying records.