Xii -Cs Practice Codes for Practical (2024-25)
Xii -Cs Practice Codes for Practical (2024-25)
❖ All students must bring practical file tomorrow (9/01/2025). In case it is incomplete bring A4 sheets for
printing remaining practical.
❖ Bring project file
QUESTION 1: (8 Marks)
1. Write a python program to create a text file “Notes.txt” and count number of alphabets , digits and special
symbols in it.
2. Write a python program to count and display number of lines that are starting with ‘T’ in a text file named “Exam.txt” .
3. Write a menu driven program to perform following operations into a binary file ‘EMP.DAT’ .
The file contains records : [id, name, job,sal] 1. Add record 2. Display All Records 3. Exit
4. Write a menu driven program to perform following operations into a binary file ‘EMP.DAT’
The file contains records : [id, name, job,sal] 1. Add record 2. Search by Id 3. Exit
5. Create a binary file “EMP.dat” having details empno, empname, designation and salary and write functions:
(a) to display all records having salary more than 50000
(b) name of all employees whose name start with ‘S’
6. Write a menu driven code to perform following operations on binary file
(a) Create a binary file with name and roll number.
(b) Search for a given roll number and display the name, if not found display appropriate message.
7. Create a CSV file to store details of 5 students (Rollno,name, class_sec,age) and display its contents.
8. Create a CSV file by entering user-id and password, read and search the password for given user- id.
9. Write a python program to implement push() , pop() and display() in stack.
10. Write a Menu driven python program using list to implement stack data structure and perform the
following operations: a. Push(), b. Pop(), c. Display() d. Exit
11. WAP in python to implement insert, select , update , delete and alter table commands using python –MySQL
connectivity.
QUESTION 2 (4 Marks) SQL queries (4 queries based on one or two tables)
Consider the following tables Stationary and Consumer. Write SQL commands for the statement (i) to (iv).
(i) To display the details of those consumers whose Address is Delhi.
(ii) To display the details of Stationary whose Price is in the range of 8 to 15. (Both Value included)
(iii) To display ConsumerName, Address, Company and Price from Stationary and Consumer with their
corresponding matching S_ID.
(iv) To increase the Price of all stationary by 2.
Q 2. Write the queries i) to iv) based on the table Customer given below:
Table : Customer