0% found this document useful (0 votes)
25 views5 pages

ComputerScience SQP

The document provides instructions for a computer science practical exam. It includes 4 questions - writing SQL commands, writing a Python function to count words in a text file, writing Python code to insert a record into a MySQL database, and allocating marks for different exam components. The questions cover skills like SQL, Python, and working with databases.

Uploaded by

Achal Srivastva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views5 pages

ComputerScience SQP

The document provides instructions for a computer science practical exam. It includes 4 questions - writing SQL commands, writing a Python function to count words in a text file, writing Python code to insert a record into a MySQL database, and allocating marks for different exam components. The questions cover skills like SQL, Python, and working with databases.

Uploaded by

Achal Srivastva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Class: XII Session: 2022-23

Computer Science (083)


AISSCE PRACTICAL
Maximum Marks: 30 Time Allowed: 3 hours
General Instructions:

1. All questions are compulsory.

1. Consider the following table STUDENT. Write SQL Commands for the following
statements. 5
TABLE : Student
Student Class Name Game Grade1 SUPW Grade2
No
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 Basket A Literature A
ball
15 10 Arpit Cricket A Gardening C
i) Display the names of the students who are getting a grade ‘C’ in either
GAME or SUPW.
ii) Display the number of students getting grade ‘A’ in cricket.
iii) Display the different games offered in the school.
iv) Display the SUPW taken up by the students, whose name starts with ‘A’.
v) Arrange the whole table in the alphabetical order to SUPW.

2.Write a function in Python that counts the number of “Me” and “My” words
present in a text file “Story.txt” contents are as follows: 4
My first book
was Me and
My family. It
gave me
chance to be
known to the
world.
The output of the function should be:
Count of Me/My in file.

1
3. The code given below inserts the following record in the table 3
Student:

RollNo – integer
Name – string
Clas – integer
Marks – integer

Note the following to establish connectivity between Python and


MYSQL:
 Username is root
 Password is tiger
 The table exists in a MYSQL database named school.
 The details (RollNo, Name, Clas and Marks) are to
be accepted from the user.
Write the following missing statements to complete the code:
Statement 1 – to form the cursor object
Statement 2 – to execute the command that inserts the record in the
table Student.
Statement 3- to add the record permanently in the database

import mysql.connector as mysql


def sql_data():
con1=mysql.connect(host="localhost",user="root",

2
password="tiger", database="school")
mycursor= #Statement 1
rno=int(input("Enter Roll Number :: "))
name=input("Enter name :: ")
clas=int(input("Enter class :: "))
marks=int(input("Enter Marks :: "))
querry="insert into student
values({},'{}',{},{})".format(rno,name,clas,marks)
#Statement 2
# Statement 3
print("Data Added successfully")

7
4
Practical Copy

5 8
Project

6
Viva 3

3
4
5

You might also like