0% found this document useful (0 votes)
66 views9 pages

CS Sample 1

Uploaded by

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

CS Sample 1

Uploaded by

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

KENDRIYA VIDYALAYA SANGHATHAN, JAMMU REGION

SAMPLE PAPER SET 1


CLASS-XII SUBJECT: COMPUTER SCIENCE
TIME: 3 HOURS M.M.: 70
General Instructions:
1. This question paper contains five sections, Section A to E.
2. All questions are compulsory.
3. Section A has 18 questions carrying 01 mark each.
4. Section B has 07 Very Short Answer type questions carrying 02 marks each.
5. Section C has 05 Short Answer type questions carrying 03 marks each.
6. Section D has 03 Long Answer type questions carrying 05 marks each.
7. Section E has 02 questions carrying 04 marks each. One internal choice is given in Q35
against part c only.
8. All programming questions are to be answered using Python Language only.

Section A
1 Write full form of CSV. 1
2 Which is valid keyword? 1
a. Int b. WHILE c.While d.if
3 Which of the following is not a valid identifier name in Python? 1
a) 5Total b) _Radius c) pie d)While
4 Consider the following expression: 1
51+4-3**3//19-3
Which of the following will be the correct output if the expression is evaluated?
a. 50
b. 51
c. 52
d. 53
5 Select the correct output of the code: 1
Str=“Computer”
Str=Str[-4:]
print(Str*2)
a. uter
b. uterretu
c. uteruter
d. None of these
6 Which module is imported for working with CSV files in Python? 1
a. csv
b. python-csv connector
c. CSV
d. python.csvconnector
7 Fill in the blank: 1
_____ command is used to update records in the MySQL table.
(a) ALTER (b) UPDATE (c) MODIFY (d) SELECT
8 Which command used to fetch rows from the table in database? 1
(a) BRING (b) FETCH (c) GET (d) SELECT
9 Which of the following statement(s) would give an error after executing the following 1
code?
print(9/2) # Statement-1
print(9//2) # Statement-2
print(9%%2) # Statement-3
print(9%2) # Statement-4

(a) Statement-1 (b) Statement-2 (c) Statement-3 (d) Statement-4


10 Fill in the blanks: 1
_______ is the table constraint used to stop null values to be entered in the field.
(i) Unique
(ii) Not NULL
(iii) Not Empty
(iv) None
11 The correct syntax of read() function from text files is: 1
a. file_object.read()
b. file_object(read)
c. read(file_object)
d. file_object().read

12 Fill in the blank: 1


In SQL, we use _____ command to display the list of databases in the server.
(a) SELECT DATABASES;
(b) SELECT DATABASE;
(c) SHOW DATABASES;
(d) DESC;
13 Fill in the blank: 1
________ protocol is used to send mail.
(a) SMTP (b) FTP (c) POP (d) HTTPS
14 What will the following expression be evaluated to in Python? 1
10*1*2**4-4//4
15 Which function is used to display the maximum of records from table in a database? 1
(a) MAX (b) MAXIMUM (c) LARGEST (d) GREAT
16 To establish a connection with MySQL from Python which of the following functions is 1
used?
(a) connection() (b) connect() (c) open() (d) cursor()
Q17 and 18 are ASSERTION AND REASONING based questions. Mark the correct
choice as:
(a) Both A and R are true and R is the correct explanation for A
(b) Both A and R are true and R is not the correct explanation for A
(c) A is True but R is False
(d) A is false but R is True
17 Assertion (A): Global variable is declared outside the all the functions. 1
Reasoning (R): It is accessible through out all the functions.
18 Assertion (A): Binary files store all data in text format. 1
Reasoning (R): Binary files data remain in its original type.
Section B
19 Rajat has written the following Python code. There are some errors in it. Rewrite the 2
correct code and underline the corrections made.
DEF execmain():
x = input("Enter a number:")
if (abs(x)=x):
print ("You entered a positive number")
else:
x=*-1
print "Number made positive:"x
execmain()
20 Write two advantages of star topology and bus topology each. 2

OR

Briefly explain HTML and HTTP.


21 a. Find output generated by the following code: 1+1
mystr = “Hello I am a Human.”
print(mystr[::-3])

b. Write the output of the code given below:


p=10
q=20
p*=q//3
p=q**2
q+=p
print(p,q)
22 Differentiate between DDL and DML with one Example each. 2
23 a. Give the full form of the following: 2
i. URL
ii. FTP

b. What is the use of HTTP?


24 Predict the output of the following code: 2

def CALLME(n1=1,n2=2):
n1=n1*n2
n2+=2
print(n1,n2)
CALLME()
CALLME(3)

OR

mylist = [2,14,54,22,17]
tup = tuple(mylist)
for i in tup:
print(i%3, end=",")

25 Answer the following : 2


i) Name the package imported for connecting Python with MySQL database.
ii) What is the purpose of cursor object?

OR

What is primary key in MySQL database? Give an example.

Section-C
26 a. Consider the following tables Trainer and Course: 1+2

What will be the output of the following statement?


SELECT * FROM TRAINER NATURAL JOIN COURSE;

b. Write the Outputs of the MySQL queries (i) to (iv) based on the given above tables:
i. SELECT DISTINCT(CITY) FROM TRAINER WHERE SALARY>80000;
ii. SELECT TID, COUNT(*), MAX(FEES) FROM COURSE GROUP BY TID
HAVING COUNT(*)>1;
iii. SELECT T.TNAME, C.CNAME FROM TRAINER T, COURSE C WHERE
T.TID=C.TID AND T.FEES<10000;
iv. SELECT COUNT(CITY),CITY FROM TRAINER GROUP BY CITY;
27 Write a method/function COUNTLINES_ET() in python to read lines from a text file 3
REPORT.TXT, and COUNT those lines which are starting either with ‘E’ or starting
with ‘T’ and display the Total count separately.
For example:
If REPORT.TXT consists of
“ENTRY LEVEL OF PROGRAMMING CAN BE LEARNED FROM PYTHON. ALSO, IT
IS VERY FLEXIBLE LANGUGAE. THIS WILL BE USEFUL FOR VARIETY OF
USERS.”
Then, Output will be:
No. of Lines with E: 1
No. of Lines with T: 1
OR
Write a method/ function SHOW_TODO() in python to read contents from a text file
ABC.TXT and display those lines which have occurrence of the word ‘‘TO’’ or
‘‘DO’’.
For example :
If the content of the file is
“THIS IS IMPORTANT TO NOTE THAT
SUCCESS IS THE RESULT OF HARD WORK.
WE ALL ARE EXPECTED TO DO HARD WORK.
AFTER ALL EXPERIENCE COMES FROM HARDWORK.”

The method/function should display:


THIS IS IMPORTANT TO NOTE THAT
WE ALL ARE EXPECTED TO DO HARD WORK.
28 a. Write the outputs of the SQL queries (i) to (iv) based on the relations Teacher and 3
Posting given below:

i. SELECT Department, count(*) FROM Teacher GROUP BY Department;


ii. SELECT Max(Date_of_Join),Min(Date_of_Join) FROM Teacher;
iii. SELECT Teacher.name,Teacher.Department, Posting.Place
FROM Teacher, Posting
WHERE Teacher.Department = Posting.Department AND Posting.Place=”Delhi”;
iv. SELECT Gender, COUNT(Gender) FROM Teacher GROUP BY Gender;

b. Write the command to view the schema of the table Teacher.


29 Python funtion oddeve(L) to print positive numbers in a list L. 3
Example:
Input: [4, -1, 5, 9, -6, 2, -9, 8]
Output: [4, 5, 9, 2, 8]
30 Write a function AddCustomer(Customer) in Python to add a new Customer information 3
into the stack (list) CStack and display the information.

OR

Write a function DeleteCustomer() to delete a Customer information from a list of


CStack. The function delete the name of customer from the stack.
Example: If the stack contains [“Abhinav”,”Vimank”],
the output should be:
Vimank
Abhinav
Section-D
31 Prithvi Training Institute is planning to set up its centre in Jaipur with four specialized 5
blocks for Medicine, Management, Law courses along with an Admission block in
separate buildings. The physical distances between these blocks and the number of
computers to be installed in these blocks are given below. You as a network expert have
to answer the queries raised by their board of directors as given in (i) to (v).

i. Suggest the most suitable location to install the main server of this institution
to get efficient connectivity.
ii. Suggest by drawing the best cable layout for effective network connectivity
of the blocks having server with all the other blocks.
iii. Suggest the devices to be installed in each of these buildings for connecting
computers installed within the building out of the following:
Modem, Switch, Gateway, Router
iv. Suggest the most suitable wired medium for efficiently connecting each
computer installed in every building out of the following network cables:
Coaxial Cable, Ethernet Cable, Single Pair, Telephone Cable
v. Suggest the type of network implemented here.
32 (a) Write the output of following python code: 2+3

def result(s):
n = len(s)
m=''
for i in range(0, n):
if (s[i] >= 'a' and s[i] <= 'm'):
m = m + s[i].upper()
elif (s[i] >= 'n' and s[i] <= 'z'):
m = m + s[i-1]
elif (s[i].isupper()):
m = m + s[i].lower()
else:
m = m + '#'
print(m)
result('Cricket')
(b) Avni is trying to connect Python with MySQL for her project. Help her to write the
python statement on the following:
i. Name the library, which should be imported to connect MySQL with Python.
ii. Name the function, used to run SQL query in Python.
iii. Write Python statement of connect function having the arguments values as :
Host name :192.168.11.111
User : root
Password: Admin
Database : MYPROJECT
OR
(a) Find the output

Msg1="WeLcOME"
Msg2="GUeSTs"
Msg3=""
for I in range(0,len(Msg2)+1):
if Msg1[I]>="A" and Msg1[I]<="M":
Msg3=Msg3+Msg1[I]
elif Msg1[I]>="N" and Msg1[I]<="Z":
Msg3=Msg3+Msg2[I]
else:
Msg3=Msg3+"*"
print(Msg3)
b) Your friend Jagdish is writing a code to fetch data from a database Shop and table
name Products using Python. He has written incomplete code. You have to help him
write complete code:
import __________ as m # Statement-1
object1 = m.connect(
host="localhost",
user="root",
password="root",
database="Shop"
)
object2 = object1._____ # Statement-2
query = '''SELECT * FROM Products WHERE NAME LIKE "A%";'''
object2._____(query) # Statement-3
object1.close()
33 What is the advantage of using pickle module? 2+3
Write a program to write into a CSV file “one.csv” Rollno, Name and Marks separated
by comma. It should have header row and then take input from the user for all following
rows. The format of the file should be as shown if user enters 2 records.
Roll.No,Name,Marks
20,Ronit,67
56,Nihir,69
OR
What is difference between tell() and seek() methods?
Write a program to read all content of “student.csv” and display records of only those
students who scored more than 80 marks. Records stored in students is in format :
[Rollno, Name, Marks]
34 ABC Gym has created a table TRAINER. Observe the table given below and answer the 1+1
following questions accordingly. +2

a. What is Degree and Cardinality of the above table?


b. Which field should be made as the primary key? Justify your answer.
c. Write the query to:
i. Insert a record: (107,Bhoomi,Delhi,2001-12-15,90000)
ii. Increase the salary by 1% for the trainers whose salary is more than 80000
OR
i. Delete the record of Richa
ii. Add a new column remarks of VARCHAR type with 50 characters.
Section E
35 Priti of class 12 is writing a program to create a CSV file “emp.csv”. She has written the 1+1
following code to read the content of file emp.csv and display the employee record +2
whose name begins from “S‟ also show no. of employee with first letter “S‟ out of total
record. As a programmer, help her to successfully execute the given task.
Consider the following CSV file (emp.csv):
1,Peter,3500
2,Scott,4000
3,Harry,5000
4,Michael,2500
5,Sam,4200

import _____ # Line-1


def snames():
with open(______) as csvfile: # Line-2
myreader = csv.___ (csvfile, delimiter=",") # Line-3
count_rec=0
count_s=0
for row in myreader:
if row[1][0].lower() == "s":
print(row[0],",",row[1],",",row[2])
count_s += 1
count_rec += 1
print(count_rec, count_s)
i. What should be written in Line-1?
ii. In which mode should Priti open the file to print the data?
iii. What should be written in Line-2 and Line-3?

You might also like