PLACID VIDYA VIHAR SR. SEC.
SCHOOL
Computer Science – Practical List 2020-21
Python
1. Write a random number generator that generates random numbers between 1 and 6
(simulates a dice).
2. Input a string and determine whether it is a palindrome or not; convert the case of
characters in a string, remove the characters that are repeated.
3. Accept a string –
i. Count and display the number of vowels, consonants, uppercase, lowercase
characters in string.
ii. Accept a character - Split string w.r.t this character
iii. Replace the repeated character with a ‘#’
4. Find the smallest and largest such number from the given list of numbers.
5. Input a list of numbers and swap elements at the even location with the elements at
the odd location.
6. Input a list of numbers and test if a number is equal to the sum of the cubes of its
digits.(Check any number is Armstrong)
7. Input a list of elements, search for a given element and remove it from the list
i. Without using a built-in function.
ii. Using a function.
8. Input a list sort it
i. Bubble sort it –without built-in function
ii. using built-in function
9. Write a Python menu driven program to implement a stack(LIFO) using a list data-
structure.
10. Write a Python menu driven program to implement a queue(FIFO) using a list data-
structure.
11. Write a program to create ‘word.txt’ file - by accepting sentences. Also Display
content of file, number of characters and number of words in it[ Hint: accept
characters using stdin.read() from user, read file- character by character].
12. WAP to create story.txt file containing n lines accepted from user. Display each
word separated by a #[ Hint: accept n lines using stdin.readline() from user, read line
by line].
13. WAP to create pledge.txt in binary(use encode() & decode()). Display the contents
line by line along with number characters in each line[ Hint: accept lines using
stdin.readlines() from user, read file- all lines].
14. Create a .txt file. Remove all the lines that contain the character `a' in lines.txt file
and write it to another file –newfile.txt
15. Take a sample of ten phishing e-mails (or any text file) and find most commonly
occurring word(s).
16. Write a program to – store records of students
i. Create a mark.dat binary file with roll number, name and marks.[Hint: Write
record by record]
ii. Display the content[Hint: read record by record]
iii. Modify name/marks - Input a roll number and update the name/marks.
iv. Search and display the details of a particular rollno.
1
PLACID VIDYA VIHAR SR. SEC. SCHOOL
Computer Science – Practical List 2020-21
v. Exit
Record must be a dictionary { key- Rollno : value-nested dictionary of Eng, Phy ,
che, Maths & CS}
17. Create a binary file student.dat – by accepting details in a dictionary that contains the
roll number, name and marks of n students in a class and display the names of students
who have marks above 75. [Hint: write & read all records together]
18. Create a program for entering details of n employees from user and insert it in a binary
file named ‘emp.dat’ through dictionary. Display the entire details and also display
whose salary is between 25000 and 30000.(use pickle)
[empno,empname,j ob & sal]
19. Write a menu driven program to create a csv file –login.csv that accepts username,
user id and password. (1. Create 2. Display 3. Search a user name 4. Delete. 5. Exit )
20. Create Table Garment and Fabric –Python –Sql Connectivity.
SQL-
21. Consider tables Garment and Fabric.
a. Display min, max, sum, and average price for each fabric codes in table Garment.
b. Find the total number of garments in each Type.
c. Increase the price of ‘SLACKS’ by 150
d. Display fabric code, description, price and type of all garments
e. Display Maximum Fabric code, minimum Readydate
f. Display different Fabric codes
g. Display number of different Fabric codes.
h. Display the name of fabrics whose length contains more than 5 characters
i. Display the name of fabrics ready in 2008( using function year and LIKE – 2
commands)
j. Display Equi-join
k. Display natural join
22. Create a student table with the student id, name, and marks in five subjects (Eng, Phy,
Che, Maths, CS)
a. Add columns Tot and Grade
b. Update Tot and Grade using queries(s).
c. Delete the details of a student in the above table whose mark not assigned.
d. Display the details of the students with marks more than 80.
e. Display the min, max, sum, and average of the marks in a student marks table.
f. Order the (student ID, marks) table in descending order of the marks.