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

DELHI PUBLIC SCHOOL

NACHARAM
Term II - PRACTICAL RECORD PROGRAMS
SUB: COMPUTER SCIENCE CLASS: XII 2022-23

11. Read a text file line by line and display each word separated by a #.

12. Read a text file and display the number of vowels/consonants/uppercase/lowercase


characters in the file.

13. Remove all the lines that contain the character 'a' in a file and write it to another file.

14. Create a binary file with name and roll no. Search for a given roll number and display the
name, if not found display appropriate message.

15. Write a program to read a file and print the contents of the file along with the number of
lines which are starting with ‘A’.

16. Write a program to create a binary file with roll number, name and marks. Input a roll
number and update the marks.

17. Create a binary file with name and roll no. Search for a given roll number and display the
name, if not found display appropriate message.

18. Create a CSV file by entering user id and password, read and search the password for given
user id

19. Write a python program to implement a stack (push, pop, peek, display) using list

20. Write SQL commands for the following


I. Create table STUDENT with rollno, name,class,marks:
II. Insert 5 record into the table STUDENT with constraints
III. delete records number 4 from the table STUDENT:
IV. display the result table STUDENT
V. update table with 2 new records
21. Create a student table and insert data. Implement the following SQL commands on the
student table:
i. ALTER table to add new attributes / modify data type / drop attribute
ii. UPDATE table to modify data
iii. ORDER By to display data in ascending / descending order
iv. DELETE to remove tuple(s)
v. GROUP BY and find the min, max, sum, count and average
22. Write SQL commands for the following
i. Create a table EMPLOYEE with the following structure
(Emp_Id, FirstName, LastName, User_Id , Salary)
ii. Insert 5 records into the employee table with minimum 1 constraint
iii. Update record with last name,user id and salary. Make the changes permanant
iv. Modify the lastname of the employee 3 to another name
v. Modify the Salary and increase it by 1000,for all who get salary less than 5000
vi. Add one column email of data type varchar and size 30 to the table Employee

23. Write SQL Commands for the following.


i. Create Student table with following fields and enter data are given in the
table below

Data to be Entered

ii. List the students whose department is "CS":


iii. List all students of age 20 and more in ME department
iv. List the student department wise:
v. Modify the class ME2 to ME1.

24. Write SQL Query to create the tables CARDEN and CUSTOMER and write given SQL
commands.
Table: CARDEN

CCODE CARNAME MAKE COLOR CAPACITY CHARGES


501 A-Star Suziki Red 3 14
503 Indigo Tata Silver 3 12
502 Innova Toyota Whiler 7 15
509 SX4 Suziki Silver 4 14
510 CClass Mercedes Red 4 35
Table: CUSTOMER

CODE CNAME CCODE


1001 Hemanth 501
1002 Raj 509
1003 Shaz 503
1004 Ketan 502

i. Write SQL commands to create the above tables and insert the records in it as
given above
ii. To display the names of all the silver coloured cars
iii. To display name of the car, make and capacity of cars in descending order of
their seating capacity
iv. To display the highest charges at which a vehicle can be hired from CARDEN
v. To display the customer name and the corresponding name of the cars hired by
them
vi. To count and display colour from the table carden
vii. Update the record cname Raj Kumar where code=1002
viii. Add a new column CTYPE into the table customer

25. Write the Python code to connect MYSQL database.


i. Create database with code
ii. Create table
iii. Insert records
iv. Display all records

26. Explain the following with examples in IDLE connectivity.


i. fetchone()
ii. fetchmany()
iii. fetchall()
iv. rowcount

You might also like