Practical File XII CS
Practical File XII CS
Class: XII
Instructions:
● Do all the following SQL Queries on the computer system.
● Take clear and readable screenshots of queries and outputs in MS Word file and mail
at: [email protected]
● After the confirmation on mail, take print outs and bring them in the folder.
● Printouts will be taken in such a manner that SQL or Python Code should be on the right
side of the file and SQL or Python outputs should be on the left side of the file.
● Front page of the file should contain:
REPORT FILE
(SESSION- 2024-25)
(name) Ms Priyanka
Rastogi
XII - A
(Board Roll No.)
Index Page:
Copy all the questions here. Date has to be mentioned on which you have done (Any date of
June).
Student No Class Name Game Grade1 SUPW Grade2
Q2. Write SQL commands for the following on the basis of given table CLUB:
(i) To show all information about the swimming coaches in the club.
(ii) To list the names of all coaches with their date of appointment( Datofapp) in descending order.
(iii) To display a report, showing coachname, pay age, bonus (15 % of pay) for all coaches.
(iv) To rename attribute ‘pay’ to ‘salary’.
(v) To delete the record of Karan.
Q3. Write SQL commands for the following on the basis of the given table STUDENT.
(i) Select all the non medical stream students from the student table.
(ii) List the name of those students who are in class 12 sorted by stipend.
(iii) Display a report listing name, stipend, stream and amount of stipend received in a year
assuming that the stipend is paid every month.
(iv) Count the number of students getting grade B and C.
(v) Display all stream from the table student.
Q4. Give the output of the following SQL commands with respect to table STUDENT in the
previous question.
Q5 Write SQL queries based on the table PASSENGER and FLIGHT given below:
Table: PASSENGER
Table: FLIGHT
Q6 Write code to connect to a MySQL database namely School and then fetch all those records
from table Student where grade is ‘A’.
Q7. Bharti Public School is managing student data in the Student table in School Database.
Write a Python code that connects to a database school and retrieves all records and displays
the total number of students.
Q8 Create a database TestDb. Create a table Employee with fields first_name, last_name,
age, sex, income. Insert below two records in it:
Manoj , Kumar ,30, M, 25000
Karan, Verma, 32, M, 27000
Q9. Write a program with reference to the above table “Employee” to increase the salary of
employees, whose name is Manoj Kumar by Rs 3000.
(PYTHON PROGRAMS)
Q10 WAP to read a text file line by line and display each word separated by a #.
Q11 WAP to read a text file and display the number of
vowels/consonants/uppercase/lowercase characters in the file.
Q12 WAP to remove all the lines that contain the character 'a' in a file and write it to another file.
Q13 Create a binary file with name and roll number. Search for a given roll number and display
the name, if not found display appropriate message.
Q14 Create a binary file with roll number, name and marks. Input a roll number and update the
marks.
Q15 Write a random number generator program that generates random numbers between 1
and 6 (simulates a dice).
Q16 Write a program to accept values from a user in a tuple. Add a tuple to it and display its
elements one by one. Also display its maximum and minimum value.
Q17 Create a CSV file by entering user-id and password, read and search the password for
given user id.
Q18 Write a program to create a dictionary from a string.
Note: Track the count of the letters from the string.
Sample string : 'w3resource'
Expected output: {'w': 1, '3': 1, 'r': 2, 'e': 2, 's': 1, 'o': 1, 'u': 1, 'c': 1}
Q19 Write a function, lenWords(STRING), that takes a string as an argument and returns a
tuple containing the length of each word of a string. For example, if the string is "Come let us
have some fun", the tuple will have (4, 3, 2, 4, 4, 3)
Q20 Write a function in Python to read a text file, Alpha.txt and display those lines which begin
with the word ‘You’.
Q21 Write a function, vowelCount() in Python that counts and displays the number of vowels in
the text file named Poem.txt.
Q22 Write a function listchange(Arr) in Python , which accepts a list of numbers and replace
each even number by value 10 and multiply odd number by 5.
Sample input data of the list is:
a= [10,20,23,45]
listchange(a)
Output: [10,10,115,225]
Q23 A dictionary student contains rollno and marks of students. Two empty lists stack_roll and
stack_mark will be used as stack. Two functions Push_student() and Pop_student() are defined
and perform the following operation:
(i) Push_student(): It reads dictionary student and adds keys into stack_roll and stack_marks for
all students who secured more than 60 marks.
(ii) Pop_student(): It removes last rollno and marks from both list and prints “underflow” if there
is nothing to remove.
Example:
Student = {1:56, 2:45, 3:78, 4:65, 5: 35, 6: 90}
Values of stack_roll and stack_mark after Push_student function:
[3,4,6] and {78,65,90}