XII CS Monthly Exam - Sept

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

KENDRIYA VIDYALAYA , NAGERCOIL

MONTHLY TEST – SEPTEMBER 2019


CLASS XII
SUBJECT : COMPUTER SCIENCE
Time : 60 mins
Max Marks : 25
Note : a) All questions are compulsory.
b) Give examples wherever possible.
Q1. Differentiate between fetchall () and fetchone() (2)
Q 2. What is/are the import statement/statements in the views.py file in a django project? (2)
Q 3. Which method is used to execute SQL query in python? Give example. (1)
Q 4. Name the attribute which returns the number of rows affected on executing an SQL query (2)
via python. Give the syntax and example.
Q 5. Which library is imported in the program implementing MySQL connectivity with python? (1)
Q 6.
a) Write a python code to create a table in MySQL and insert 5 rows in it. (4)
Specifications are as follows:
Database name : School Table name : XII_CS
Structure of the table :
Column Name Data type
R.No (Primary Key) Integer
Name Varchar(25)
Class Integer
Section Char(1)
Percentage Integer
b) In the views.py file of an application ‘classxiics’ of project ‘school’ an html form is included. (4)
This views.py has a set of code to write the data sent from the form to a csv file named
‘details.csv’. What is that code?
Q 7. What is the use of commit( ) in python-mysql connectivity code? When and where is it used? (2)
Q 8. Answer the following questions on

a) Write a query to display the CNO and CNAME for who travelled more than 100 kms. (1)
b) Write a query to display the names of customers who travelled in 2015 only. (1)
c) Write a query to display the details of customers who travelled with > 30 passengers (1)
d) Write a query to display the details of customers in descending order of KM (1)
e) Write a query to display the number of males and females who travelled <= 100 kms. (1)
f) Give the output for the following:
 SELECT MAX(NOP) – MIN(NOP) FROM TRAVEL; (1)
 SELECT COUNT(CNAME) FROM TRAVEL GROUP BY GENDER (1)
HAVING KM IN(90,100,120,450);

You might also like