0% found this document useful (0 votes)
126 views

Practical File XII CS

Uploaded by

uditsp2008
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
126 views

Practical File XII CS

Uploaded by

uditsp2008
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

REPORT FILE (2024-25)

Class: XII

Subject: Computer Science

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)

COMPUTER SCIENCE (083)

Submitted By: Submitted To:

(name) Ms Priyanka
Rastogi
XII - A
(Board Roll No.)
Index Page:

S.N Programs Date Page No T. Sign


o.

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

10 7 Sameer Cricket B Photography A

11 8 Sujit Tennis A Gardening C

12 7 Kamal Swimming B Photography B

13 7 Veena Tennis C Cooking A

14 9 Archana Basketball A Literature A

15 10 Arpit Cricket A Gardening C

(i) Display the details of students who are in grade 7.


(ii) Display the names of students who are getting grade ‘C’ in either GAME or SUPW.
(iii) Display the different games offered in school
(iv) Display the SUPW taken up by the students, whose name starts with ‘A’.
(v) Modify the Game of Sujit from Tennis to Basketball.

Q2. Write SQL commands for the following on the basis of given table CLUB:

Coach_id CoachName Age Sports Datofapp Pay Sex

1 Kukreja 35 karate 27/03/1996 1000 M

2 Ravina 34 Karate 20/01/1998 1200 F

3 Karan 36 Squash 19/02/1998 2000 M

4 Tarun 34 Basketball 12/01/1998 1500 M

5 Zubin 33 Swimming 20/02/1998 750 M

6 Ankita 34 Squash 01/01/1998 800 F

7 Kush 36 Karate 14/01/1998 1700 M

(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.

ID Name Stipend Stream Avgmark Grade Class


A1 Karan 400.00 Medical 78.5 B 12B

B1 Divakar 300.00 Commerce 89.2 A 12A

C1 Divya 350.00 Humanities 68.6 C 12C

D5 Arun 500.00 Medical 73.1 B 12B

E2 Sahiba 400.00 Commerce 90.6 A 12A

(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.

(i) Select min(Avgmark) from student where Avgmark <75;


(ii) Select Sum(Stipend) from Student where Grade = ‘B’ ;
(iii) Select avg(Stipend) from student where class=’12A’;
(iv) Select count(Distinct(stream)) from student;
(v) Select max(Name) from student;

Q5 Write SQL queries based on the table PASSENGER and FLIGHT given below:
Table: PASSENGER

PNO NAME GENDER FNO

1001 Suresh MALE F101

1002 Anita FEMALE F104

1003 Harjas MALE F102

Table: FLIGHT

FNO START END F_DATE FARE

F101 MUMBAI CHENNAI 2021-12-25 4500

F102 MUMBAI BENGALURU 2021-11-20 4000

F103 DELHI CHENNAI 2021-12-10 5500

F104 KOLKATA MUMBAI 2021-12-20 4500


(i) Write a query to change the fare to 6000 of the flight whose FNO is F104.
(ii) Write a query to display the total number of MALE and FEMALE Passengers.
(iii) Write a query to display the NAME , corresponding FARE and F_Date of all Passengers
who have a flight to START from Delhi.
(iv) Write a query to delete the records of flights which end at Mumbai.
(v) Display the Flight date and fare of Nita.

(PYTHON MYSQL CONNECTIVITY PROGRAMS)

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}

Q24 A list, NList contains the following record as list elements:


[City, Country, distance from Delhi]
Each of these records are nested together to form a nested list.
Write the following user defined functions in Python to perform the specified operations on the
stack named travel.
(i) Push_element(NList): It takes the nested list as an argument and pushes a list object
containing the name of the city and country, which are not in India and distance is less than
3500 km from Delhi.
(ii) Pop_element(): It pops the objects from the stack and displays them. Also, the function
should display “Stack Empty” when there are no elements in the stack.

You might also like