0% found this document useful (0 votes)
14 views10 pages

3 Sample Paper QP

The document is a question paper for Class XII Computer Science for the academic year 2023-24, issued by Kendriya Vidyalaya Sangathan Gurugram Region. It consists of five sections (A to E) with a total of 70 marks and includes various types of questions such as multiple choice, short answer, and programming tasks primarily using Python. The paper covers topics related to Python programming, SQL queries, and data structures.

Uploaded by

gdggdfhu
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)
14 views10 pages

3 Sample Paper QP

The document is a question paper for Class XII Computer Science for the academic year 2023-24, issued by Kendriya Vidyalaya Sangathan Gurugram Region. It consists of five sections (A to E) with a total of 70 marks and includes various types of questions such as multiple choice, short answer, and programming tasks primarily using Python. The paper covers topics related to Python programming, SQL queries, and data structures.

Uploaded by

gdggdfhu
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/ 10

केन्द्रीय विद्यालय संगठन, गरु

ु ग्राम संभाग
KENDRIYA VIDYALAYA SANGATHAN GURUGRAM REGION
कक्षा- XII Class-XII
2023-24

Max Marks: 70
Subject: COMPUTER SCIENCE Time: 3 HOURS

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 Find the invalid identifier from the following 1
a) _D b) D1 c) 1D d) D_

2 Given the lists VOWELS=[“A”,”E”,”I”,”O”,”U”] , write the output of 1


print(VOWELS[-4:4])

3 Which among the following list of operators has the highest precedence? 1
*, /, +, -, %, **

4 A tuple TPL is declared as TPL = (100,200,300,400) 1


if a statement TPL[2]=250 is written then it generates an error. Name the property
of tuple which makes this statement wrong.
5 Write a statement in Python to declare a dictionary VEHICLE whose keys are 1
TATA,HYUNDAI,MARUTI and values are ALTROZ, I20 and BALENO respectively.
6 Write the name of the method to make a list empty. 1
7 What will be the output of following code. 1
>>>print(“3”+4)
8 Name the Python Library modules which need to be imported to invoke the 1
following functions : ​
i. load ()​ ​ ii. pow ()
9 What will be the output of the following python code? 1
t=(5)
t1=t*2
print(t1)

a) (5,5) b) (5) c) 10 d) 5
10 CAT-6 is type of Co-axial cable. (True/False) 1
11 Which of the following is not a legal constraint for a CREATE TABLE command? 1
a) Primary Key b) Foreign Key c) Unique d) Distinct
12 What is the best data type definition for MySQL when a field is alphanumeric and 1
has a fixed length?
a) VARCHAR b) CHAR c) INT d) DECIMAL
13 SQL is a programming language (True/False) 1
14 Write name of command for selection of a particular database. 1
15 Where and having clauses can be used interchangeably in SELECT queries. 1
(True/False)
16 The language used in application programs to request data from the DBMS is 1
referred to as _______________
a) DML b) DDL c) TCL d) None of the above
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 4
(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):- Everything in python is considered as objects and memory is 1
allocated dynamically .
Reasoning (R):- Heap and Stack is maintained during memory allocation
18 Assertion (A):- Text files are processed very fast in comparison to binary files. 1
Reasoning (R):-Binary files contain data in true binary format ( machine code )
SECTION-B
19 Evaluate the following expressions: 2
a) 5-1*27/3**2//2
b) 101 > 201 or 20 < 12 and not 25 > 25
20 What is URL and domain name. How both are related. 2
OR
How web server and web browser communicate ? Which one is known as client?
21 Rewrite the following code in Python after removing all syntax error(s). Underline 2
each correction done in the code.
x=int(“Enter value for x:”))
for y in range[0,11]:
​ if x==y:
​ ​ print x+y
​ else:
​ ​ Print(x-y)
22 Write an sql command ( query ) to remove primary key “ROLLNO” from relation 2
“STUDENTS”
23 (a) Write the full forms of the following: 2
(i) POP3 (ii) NSFNET
(b) What is the use of Gateway?
24 Find and write the output of the following Python code: 2
def Output(str1):
str2=''
index=len(str1)
while index>0:
str2+=str1[index-1]
index=index-1
return str2
print(Output('GURGAON'))
OR
def Output(S1,S2):
if (S1+S2)%2==0:
return S1+S2
else:
return S1-S2
LT= [10,15,20,12]
A=3
for I in LT:
print(Output(I,LT[A]),'#', end=' ')
A=A-1
25 In a relational data model a relation is having 10 tuples and 6 attributes. Find its 2
degree and cardinality.
or
Explain the difference between equi-join and natural join.
SECTION-C
26 Give output for following SQL queries as per given tables- 3
Table : ITEM

I_ID ItemName Manufacturer Price


PC01 Personal Computer ABC 35000
LC05 Laptop ABC 55000
PC03 Personal Computer XYZ 32000
PC06 Personal Computer COMP 37000
LC03 Laptop PQR 57000

Table : CUSTOMER
C_ID CustomerName City I_ID
01 N Roy Delhi LC03
06 H Singh Mumbai PC03
12 R Pandey Delhi PC06
15 C Sharma Delhi LC03
16 K Agarwal Banglore PC01

(i) SELECT ItemName,MAX(Price),Count(*) 1


FROM ITEM GROUPBY ItemName;
(ii) SELECT CustomerName, Manufacturer 1
FROM ITEM,CUSTOMER
WHERE ITEM.I_ID=CUSTOMER.I_ID;
(iii) SELECT ItemName, Price*100 1
FROM ITEM WHERE Manufacturer=”ABC”
27 Write a function COUNTWORD() to count words “REWARI” and “BHIWADI” 3
separately from a text file tourism.txt and display both counts. For example if
tourism.txt contains –

Bhiwadi is in Rajasthan whereas Rewari is in Haryana. Distance between Rewari


and Bhiwari is very less. Bhiwari is industrial hub.

Then COUNTWORD() function must display-

Bhiwadi : 3
Rewari : 2

OR
Write a function COUNTCHAR() to count all special characters including blank
spaces from a file “module.txt” and display it.
For example if file module.txt contains-

Regional sports meet-2022 (Boys) will be held w.e.f. 01/11/2022

Then output should be – Total characters are : 15


28 (a) Write the outputs of the SQL queries (i) to (iv) based on the relations 2
GARMENT and FABRIC given below:
Table : GARMENT

GCODE Description Price FCODE READYDATE


10023 PENCIL SKIRT 1150 F03 19-DEC-08
10001 FORMAL SHIRT 1250 F01 12-JAN-08
10012 INFORMAL SHIRT 1550 F02 06-JUN-08
10024 BABY TOP 750 F03 07-APR-07
10090 TULIP SKIRT 850 F02 31-MAR-07
10019 EVENING GOWN 850 F03 06-JUN-08
10009 INFORMAL PANT 1500 F02 20-OCT-08
10017 FORMAL PANT 1350 F01 09-MAR-08
10020 FROCK 850 F04 09-SEP-07
10089 SLACKS 750 F03 31-OCT-08

Table :FABRIC

FCODE TYPE
F04 POLYSTER
F02 COTTON
F03 SILK
F01 TERELENE

(I) SELECT SUM(PRICE) FROM GARMENT WHERE FCODE=”F01”;


(II) SELECT DESCRIPTION, TYPE FROM GARMENT,FABRIC
WHERE GARMENT.FCODE=FABRIC.FCODE AND GARMENT.PRICE>=1260;
(III) SELECT MAX(PRICE) FROM GARMENT;
(IV) SELECT COUNT(DISTINCT PRICE) FROM GARMENT;
(b) Write the command to view structure of table GARMENT 1
29 Write a function UPDATE(L1), where L1 is the list of elements passed as argument 3
to the function. The function returns another list named L2 that stores the thrice
of Elements of L1 if element is even otherwise twice of elements of L1. For
example: If L1 contains [2,5,3,6] The L2 will have - [6,10,6,18]
30 Write a function in Python PUSH(LIST), where LIST is a list of numbers. From this 3
list push all even numbers in a stack S1 and all odd numbers in a stack S2.All stacks
are implemented by using lists. Display both stack if it has at least one element,
otherwise display appropriate error message.
OR
Write a function PUSH(D) that accepts a dictionary. Push only those Keys to a stack
that have values more than 80 number. For example if dictionary contains
D={“ARUN”:85,”VARUN”:65,”TARUN”:95,”MANYA”:75}
then PUSH() function must print stack as [“ARUN” ,“TARUN”]
SECTION D
31 CITY CABLE NETWORK has set up its new centre at HYDERABAD for its office and 5
web based activities. It has four buildings as shown in the diagram below:

​ ​ ​ ​ ​ ​


Block A 25
Block B 50
Block C 125
Block D 10
Center to center distances ​ ​ ​ Number of Computers
Black A to Block B 50 m
Block B to Block C 150
m
Block C to Block D 25 m
Block A to Block D 170
m
Block B to Block D 125
m
Block A to Block C 90 m

(i) Which type of network is this


a)LAN b)PAN c)WAN d)TAN
(ii) Suggest a cable layout of connections between the blocks.​ ​ ​
(iii) Suggest the most suitable place (i.e. block) to house the server of this organisation
with a suitable reason.
(iv) Suggest the placement of the following devices with justification​ ​
▪​ Repeater
▪​ Hub/Switch

(v) The organization is planning to link its front office situated in a far city in a hilly
region where cable connection is not feasible, suggest a way to connect it with
reasonably high speed?
32
(a) Find and write the output of the following python code: 2
def FUN(P ,Q=50):
P=P+Q
Q=P-Q
print(P,"#",Q)
return (P)
R=300
S=200
R=FUN(R,S)
S=FUN(S)
(b) Fill all the given blanks for the following python code with sql interface so that 3
contents of table student can be read and displayed using python program.

import ---------------------------------------- as s1 #BLANK1


conn=s1.connect(host="localhost",user="root",password="abccba",
database="kvrewari")
cursor=conn.cursor()
cursor.---------------------------- ("select * from student")#BLANK2
rec=cursor.----------------------() #BLANK3
for i in rec:
print(i)
OR
(a) Find and write the output of the following python code : 2
def STRIN(s):
k=len(s)
m=””
for I in range(0,k):
if(s[i].isupper()):
m=m+s[i].lower()
elif s[i].isalpha():
m=m+s[i].upper()
else:
m=m+’##’
print(m)
STRIN(‘kvs22@GGN’)
(b) (b) The code given below reads the following record from the table named Player 3
and displays only those records who have weight greater than 60:
PID– integer PName – string Page– integer Pweight – integer
Note the following to establish connectivity between Python and MYSQL:
∙ Username is root∙ Password is 2022r ∙ The table exists in a MYSQL database
named GAMES.
Write the following missing statements to complete the code:
Statement 1 – to form the cursor object
Statement 2 – to execute the query that extracts records of those players whose
weight is greater than 60.
Statement 3- to read the complete result of the query (records whose weight is
greater than 75) into the object named data, from the table Player in the
database.
import mysql.connector as mysql
def sql_data():
con1=mysql.connect(host="localhost",user="root", password="2022r",
database="GAMES")
mycursor=_______________ #Statement 1
print("Players having weight greater than 60 are : ")
_________________________ #Statement 2
data=__________________ #Statement 3
for i in data:
print(i)
print()
33 Write full form of csv? Write a Program in Python that defines and calls the 5
following user defined functions:

(i) INSERT() – To accept and add data of a teacher to a CSV file ‘data.csv’. Each
record consists of a list with field elements as tpid, tname and tmobile to store
teacher id, teacher name and teacher mobile no respectively.
(ii) COUNTR() – To count the number of records present in the CSV file named
‘data.csv’.
OR
What do you mean by file modes? Write a Program in Python that defines and
calls the following user defined functions:
(i) INSERT() – To accept and add data of movies to a CSV file ‘moviedata.csv’. Each
record consists of a list with field elements as Mid, Mname and Mtprice to store
movie id, movie name and movie ticket price respectively.
(ii) FIND()- To display the records of the movies whose ticket price is more than
200.

SECTION E
34 Write SQL queries for the question no (i), (ii) and output of (iii)​ ​ 4
​ ​ ​ ​ ​ TABLE : TRANSACT
TRNO ANO AMOUNT TYPE DOT
T001 101 2500 Withdraw 2017-12-21
T002 103 3000 Deposit 2017-06-01
T003 102 2000 Withdraw 2017-05-12
T004 103 1000 Deposit 2017-10-22
T005 101 12000 Deposit 2017-11-06

(I) Identify the most appropriate column, which can be considered as Primary key.
(II) If one column is added and 2 rows are deleted from the table result, what will be
the new degree and cardinality of the above table?
(iii) Write the statements to:
a. Insert the following record into the table TRNO- T006, ANO- 102,
AMOUNT-1600, TYPE-Deposit, DOT- 2018-04-26.
b. Increase the AMOUNT of T001 by 500.
OR (Option for part iii only)
Write the statements to:
a. Delete the record of Deposit Transactions.
b. Add a column interest in the table with datatype as integer
35 Mahendra is a Python programmer. He has written a code and created a binary file 4
collection.dat with product id, product name and product price. The file contains
10 records. He now has to update a record based on the product id entered by the
user and update the price. The updated record is then to be written in the file
file2.dat. The records which are not to be updated also have to be written to the
file file2.dat. If the product id is not found, an appropriate message should to be
displayed. As a Python expert, help him to complete the following code based on
the requirement given above:
import _______ #Statement 1
def update_data():
rec={}
fin=open("collection.dat","rb")
fout=open("_____________") #Statement 2
found=False
pid=int(input("Enter product id to update price:: "))
while True:
try: rec=______________ #Statement 3
if rec["PID"]==pid:
found=True
rec["PRICE"]=int(input("Enter new price:: "))
pickle.____________ #Statement 4
else: pickle.dump(rec,fout)
except:
break
if found==True:
print("The price of product id ",pid," has been updated.")
else:
print("No product with such id is found")
fin.close()
fout.close()
(i) Which module should be imported in the program? (Statement 1)
(ii) Write the correct statement required to open a temporary file named file2.dat.
(Statement 2)
(iii) Which statement should Mahendra fill in Statement 3 to read the data from
the binary file, collectionb.dat
(iv) In Statement 4 Write the statement for updating data in the file, file2.dat

------------

You might also like