You are on page 1of 14

SET NO - 1/2/3

Roll No. Candidates must write the Set No. on


the title page of the Answer Sheet.

SAMPLE QUESTION PAPER – 2 (2022-23)

 Please check that this question paper contains 14 printed pages.


 Set number given on the right-hand side of the question paper should be written on
the title page of the answer book by the candidate.
 Check that this question paper contains 35 questions.
 Write down the Serial Number of the
(Theory: question in the left side of the margin before
Pre-Term-1)
attempting it.
 15 minutes time has been allotted to read this question paper. The question paper
will be distributed 15 minutes prior to the commencement of the examination. The
students will read the question paper only and will not write any answer on the
answer script during this period.

CLASS-XII

SUB:COMPUTER SCIENCE (083)

Time Allowed: 3 Hours Maximum Marks: 70

General Instructions:

 This question paper contains five sections, Section A to E.


 All questions are compulsory.
 Section A has 18 questions carrying 01 mark each.
 Section B has 07 Very Short Answer type questions carrying 02 mark each.
 Section C has 05 Short Answer type questions carrying 03 mark each.
 Section D has 03 Long Answer type questions carrying 05 mark each.
 Section E has 02 questions carrying 04 mark each. One internal choice is given
in Q35 against part c only.
 All programming questions are to be answered using Python Language only.
 All programming questions are to be answered using Python language only.

Sample Question Paper/CSC-XII/SET-I Page 1 of 14


SECTION-A
1 State True or False. 1
“The # symbol used for inserting comments in Python is a token”.
2 Find the datatype of „A‟ in the following statement. 1
A=100-10,100,10,10+100,10*100
(a) list (b) tuple (c) integer (d) Error
3 Given the following dictionary: 1
D={'B':'Black','R':'Red','B':'Blue'}
Find the value of D1:
D1=dict.fromkeys(D)
(a) {'B': None, 'R': None, 'B': None}
(b) {'Black': None, 'Red': None, 'Blue': None}
(c) {'B': ' ', 'R': ' '}
(d) {'B': None, 'R': None}
4 Consider the given expression: 1
not True and not False or not not False and not True
Which of the following will be correct output if the given expression is evaluated?
(a) True (b) False (c) None (d)Error in the code
5 Select the correct output of the code: 1
a='AISSCE 2023'
b=len(a.split('S')+list(a.partition(' ')))
print(b)
(a) 4 (b) 5 (c) 6 (d) 7
6 Which of the following is not a correct Python statement to open a binary file Notes.dat 1
to write content into it?
(a) F=open('Notes.dat', 'wb')(c) F=open('Notes.dat', 'rb')
(b) F=open('Notes.dat', 'wb+')(d) F=open('Notes.dat', 'rb+')
7 Fill in the blank: 1
______ command is used to change the price of a product.
(a) UPDATE (b) ALTER (c) CREATE (d) RENAME
8 Which SQL command is used to remove row(s) from the table Student? 1
(a) Drop Table Student

Sample Question Paper/CSC-XII/SET-I Page 2 of 14


(b) Drop From Student
(c) Delete * From Student
(d) Delete From Student
9 Which of the following statement(s) would give an error after executing the following 1
code?
def prod (int a): #Statement 1
d=a*a #Statement 2
print(d) #Statement 3
return prod #Statement 4
(a) Statement 1 and Statement 2(c) Statement 1 and Statement 4
(b) Statement 1 and Statement 3(d) Statement 2 and Statement 4
10 Fill in the blank: 1
In DBMS, ________ is a candidate key in a relation.
(a) Foreign Key
(b) Alternate Key
(c) Primary Key
(d) All of the above
11 Which of the following statement is correct to position the file pointer at the beginning of 1
the file?
(a) FileObject.seek(0,0)
(b) FileObject.seek(0,1)
(c) FileObject.seek(1,0)
(d) FileObject.seek(0,2)
12 Fill in the blank: 1
_________ command is used to view the structure of the table.
(a) VIEW (b) DESC (c) SELECT (d) SHOW
13 Which unguided transmission media is required to be in line-of-sight distance? 1
(a) Radio Wave
(b) Satellite
(c) Micro Wave
(d) All of the above
14 What will the following expression be evaluated to in Python? 1
print((15//2*3+4)+10%3)
(a) 8 (b) 7 (c) 2 (d) 26

Sample Question Paper/CSC-XII/SET-I Page 3 of 14


15 Which of the following operator is used for pattern matching? 1
(a) BETWEEN(c) IS LIKE
(b) HAVING(d) LIKE
16 A resultset is extracted from the database using the cursor object (that has been already 1
created) by giving the following statement.
Mydata=cursor.fetchone()
What will be the datatype of Mydata object after the given command is executed?
(a) tuple(b) list
(c) nested tuple(d) hexadecimal address
Q17 and Q18 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): The local and global variables declared with the same name in the function 1
are treated same by the Python interpreter.
Reason (R): The variable declared within the function block is treated to be local variable
whereas, the variable declared outside the function block will be referred to as global
variable.
18 Assertion (A): Python provides a built-in module called csv module to enable reading and 1
writing operation in csv file.
Reason (R): It used mainly the classescsv.writer and csv.reader. The csv.writer class
creates a writer object, whereas the csv.reader class returns a reader object.
SECTION-B
19 Rishi has written a code and his code is having errors. Rewrite the correct code and 2
underline the corrections made.
x=input("Enter a no:-")
if x%2=0:
for i range(2*x):
Print(i)
loop else:
print("#")
20 Write two points of differences between Switch and Hub. 2
(OR)
Write any two points of differences between Star Topology and Bus topology.
Sample Question Paper/CSC-XII/SET-I Page 4 of 14
21 (a) Given is a Python string declaration: 1
S="Cyber World @@ 2022"
Write the output of: print(S.replace('2','2+1')[::-2])
(b) Write the output of the code given below: 1
D={'India':'New Delhi', 'China':'Beijing', 'USA':'Washington DC', 'UK':'London'}
for i in D:
if 'U' in i:
D[i]+='Ok'
for i in D.values():
print(i,end=' ')
22 What is a primary key? What is its significance in a relation? 2
23 (a) Write the full forms of the following: 2
(i) GPRS (ii) XML
(b) What is the use of SMTP?
24 Predict the output of the Python code given below: 2
def div5(n):
if n%5==0:
return n*5
else:
return n+5
def output(m=5):
for i in range(0,m):
print(div5(i),'@',end='')
print()
output(7)
output()
(OR)
Predict the output of the Python code given below:
L='Alexander'
x=''
l1=[]
count=1
for i in L:
if i in ['a','e','i','o','u']:
x=x+i.upper()
Sample Question Paper/CSC-XII/SET-I Page 5 of 14
else:
if count%2!=0:
x=x+str(len(L[:count]))
else:
x=x+i
count+=1
print(x)
25 Differentiate between CHAR and VARCHAR datatype in MySQL with appropriate 2
example.
(OR)
Categorize the following commands as DDL or DML:
CREATE, DELETE, INSERT, DROP
SECTION-C
26 a) Consider the following tableStudent and Record: 1+2
Table: Student
Id Name Class City
3 Hina 3 Delhi
4 Megha 2 Delhi
6 Gouri 2 Delhi
Table: Record
Id Class City
9 3 Delhi
10 2 Delhi
12 2 Delhi

What will be the output of the following statement:


SELECT student.name, student.id, record.class, record.cityFROM studentJOIN record
ON student.city = record.city;
b) Write output of the queries (i) to (iv) based on the table, ORDERS given below:
Table: ORDERS
OrderId CustomerId DateOfOrder Price Qty
BT001 80 03-Jan-2018 45000 10
TRP010 78 10-Mar-2020 51000 5
BQS004 34 19-Jul-2021 22000 2
CM003 23 30-Dec-2016 12000 3
TQ006 81 17-Nov-2019 15000 12
BT006 78 01-Jan-2021 28000 14

Sample Question Paper/CSC-XII/SET-I Page 6 of 14


(i) SELECT SUM(Qty) FROM ORDERS WHERE Price>15000;
(ii) SELECT MAX(DateOfOrder) FROM ORDERS;
(iii) SELECT * FROM ORDERS
WHERE Qty>5 AND OrderId LIKE "T%";
(iv) SELECT DateOfOrder FROM ORDERS
WHERE CustomerId IN (70, 80) ;
27 Write a function COUNT() to count total occurrences of “He” and “She” separately 3
present in a text file “Story.txt”.
For example, if the content of Story.txt is: -

He has a camera. The camera belongs to him.


She has a diamond ring. She likes her ring.

Then the output should be:-


Total number of He=1
Total number of She=2
(OR)
Write a function CountVowelConso() which will calculate the total number of occurrence
of vowels and consonants in a text file „Text.txt‟.
For example, if the content of Text.txt is: -
I like Python Programming.

Then the output should be: -


Total vowels=7
Total consonant=15
28 (a) Write the outputs of the SQL queries (i) to (iv) based on the relations WORKERS and 2+1
DESIG given below:
Table: WORKERS
W_ID FIRSTNAME LAST GENDER ADDRESS CITY
NAME
102 Sam Tones M 33 Elm St Paris
105 Sarah Ackerman F U.S. 110 New York
144 Manila Sengupta F 24 Friends New Delhi
Street
210 George Smith M 83 First Street Howard
255 Mary Jones F 842,Vine Ave. Losantiville
300 Robert Samuel M 9 Fifth Cross Washington
335 Henry Williams M 12 Moore Boston
Street
403 Ronny Lee M 121 Harrison New York
St.
451 Pat Thompson M 11 Red Road Paris
Sample Question Paper/CSC-XII/SET-I Page 7 of 14
W_ID Salary Benefits Designation DE
010 75000 15000 Manager SI
105 65000 15000 Manager G

152 80000 25000 Director


(i) T
215 75000 12500 Manager
o
244 50000 12000 Clerk dis
300 45000 10000 Clerk pla
335 40000 10000 Clerk y
W_
400 32000 7500 Salesman
ID,
441 28000 7500 salesman
FI
RSTNAME, ADDRESS and CITY of all employees living in New York from the
table WORKERS.
(ii) To display the contents of WORKERS table in ascending order of LASTNAME.
(iii) To display the Minimum SALARY among managers and clerks separatelyfrom
the table DESIG.
(iv) To display FIRSTNAME and SALARY from WORKERS and DESIG Table for
each worker.

(b) Write the command to view all the databases present in the system.
29 Write a function FIND() that takes a nested list L (containing integers only) as its 3
argument. The function returns another list named „MaxList‟ that stores the largest
element of each sub list L.
For example:
If L contains [[8,11,10,12],[5,14,6,7],[2,4,5,19],[3,12,5,12]]
The MaxList will have - [12,14,19,12]
30 A list contains following record of a „Computer‟:[MACAddress, Brand, Price, RAM] 3
Write separate user defined functions to perform given operations on the stack named
„System‟:
(i) Push_element() - To Push an object containing Brand and Price of computers
whoseRAM capacity is more than 4GB.
(ii) Pop_element() - To Pop the objects from the stack and display them. Also, display
“Stack Empty” when there are no elements in the stack.

Sample Question Paper/CSC-XII/SET-I Page 8 of 14


For example:
If the lists of computer details are:

[“M001”, “Lenovo”, 75000, 16]

[“M002”, “HP”, 72000, 8]

[“M003”,”Apple”, 110000, 16]

[“M004”, “Compaq”, 50000, 4]

The stack should contain

[“Lenovo”, 75000]

[ “HP”,72000]

[”Apple”, 110000]

The output should be:

[“Lenovo”, 75000]

[ “HP”, 72000]

[”Apple”, 110000]

Stack Empty

OR

BCCI has created a dictionary containing top players and their runs as key value pairs of

cricket team. Write a program, with separate user defined functions to perform the

following operations:

● Push the keys (name of the players) of the dictionary into a stack, where the

corresponding value (runs) is greater than 49.

● Pop and display the content of the stack.

For example:
If the sample content of the dictionary is as follows:
SCORE={"KAPIL":40, "SACHIN":55, "SAURAV":80, "RAHUL":35, "YUVRAJ":110}
The output from the program should be:
YUVRAJ SAURAV SACHIN

Sample Question Paper/CSC-XII/SET-I Page 9 of 14


SECTION-D
31 TPU University is setting up its academic blocks at Udaipur and is planning to set up a
network. The University has 3 academic blocks and one Human Resource Centre as
shown in the diagram below:

Center to Center distances between various blocks/center is as follows:

(i) Suggest an ideal layout for connecting these blocks/centers for wired connectivity. 1
(ii) Which device will you suggest to be placed/installed in each of these blocks/centers 1
to efficiently connect all the computers within these blocks/centers.
(iii) Suggest the placement of Server in the network with justification. 1
(iv) The university is planning to connect its admission office in Delhi, which is more 1
than 780 km from the university. Which type of network out of LAN, MAN, or WAN
will be formed? Justify your answer.
(v) Suggest the device/ software to be installed in Udaipur campus to take care of data 1
security.
32 (a) Write the output of the code given below: 2+3
def Change(p,q=30):
global s
s=p*q
q=p//q
print(p,'@',q)
return p
p=150
Sample Question Paper/CSC-XII/SET-I Page 10 of 14
s=100
r=Change(p,s)
print(p,'@',s)
(b) A table „Student‟ is created in the database „Performance‟. The fields of „Student‟
table are: [StuID, Name, Class, Total, Grade]. Thereafter, the table is to be interfaced
with Python IDLE to perform certain tasks. The incomplete code is given below:

import mysql.connector as mycon


mydb=mycon.connect(host='localhost', '________', user='root', passwd='twelve')#Line 1
mycursor=mydb.cursor()
mycursor.execute("Select * from Student")#Line 2
________________________#Line 3
for i in record:
print(i)

Now, with reference to the above code, answer the following questions:
(i) What will you fill in Line 1 to complete the statement.
(ii) What will you fill in Line 3 to fetch all the records from the table?
(iii) What necessary change you will perform in Line 2 to display all such names from the
table „Student‟ who have secured Grade A?
OR

(a) Predict the output of the code given below:


def change():
Text1="CBSE 2021"
Text2="#"
I=0
while I<len(Text1) :
if Text1[I]>="0" and Text1[I]<="9":
Val = int(Text1[I])
Val = Val + 1
Text2=Text2 + str(Val)
elif Text1[I]>="A" and Text1[I] <="Z":
Text2=Text2 + (Text1[I+1])
else :

Sample Question Paper/CSC-XII/SET-I Page 11 of 14


Text2=Text2 + "*"
I=I+1
print(Text2)
change()
(b) A table is given below with following details:
Database: Certification
Table: Professional
Fields are: Code, Course, Duration, Eligibility, Fee
Based on the above information, the following code is given with some empty lines.
The incomplete code is given below:
import mysql.connector as mycon
mydb=mycon.connect(host='localhost', '________', user='root', passwd='twelve')#Line 1
mycursor=mydb.cursor()
mycursor.execute("Select * from Professional")
record=________________________#Line 2
rc=____________________________#Line 3
print(“First three records of the table are:”,record)
print(“Number of rows in the table”, rc)
for i in record:
print(i)
Write appropriate argument/ statement to be filled in the above blank spaces.
(i) What will you fill in Line 1 to complete the statement.
(ii) Write approprate statement in Line 2 to read first 3 records from the file.
(iii) Write approprate statement in Line 3 to find total number of rows in the table.
33 What is the use of writer object in a csv file. 5
Write a Program in Python that defines and calls the following user defined functions:
ADD(): To add data into the csv file named „Newspaper.csv‟ containing records like
Name, NumberOfPages and Press of all Indian English Newpaper.
SEARCH(): Search a specific newspaper from the file on the basis of its Name. If found,
then display the details of the newspaper, otherwise display the message „No such
newspaper found‟
OR
Give any one point of difference between a binary file and a csv file.

Write a Program in Python that defines and calls the following user defined functions:
ADD(): To add English mark of a student into the csv file named „English.csv‟
containing records like Class, Section and Marks of a student.

Sample Question Paper/CSC-XII/SET-I Page 12 of 14


COUNT(): Read all the records from English.csv. Count and display the number of
students who have secured 90 or above mark in English subject.

SECTION-E
34 Mr. Asmit is the class teacher of Class- XII-C. He created a table named „Student‟ to 1+1+2

store records like StuID, Name, Gender, Age and AvgMark of his section students.

StuID Name Gender Age AvgMark

CB01 Abhijeet Boy 19 87

CB02 Monal Girl 18 91

CB03 Divya Girl 17 89

CB04 Sujata Girl 18 78

CB05 Chirag Boy 18 77

Based on the data given above answer the following questions:

(i) Identify the most appropriate column which can become a Primary Key. Justify your

answer.

(ii) Find the degree and cardinality of the above relation if 5 new students record is added

to the existing records.

(iii) Write the statements to:

a. Insert the following record into the table

CB06, Navneeth, Boy, 18, 80.

b. Increase the AvgMark of all Girls by 3.

OR (Option for part iii only)

(iii) Write the statements to:

a. Delete the record of students whose age is 17.

b. Add a column REMARKS in the table with datatype as varchar with 50 characters.

35 Robin, a software programmer is writing a program to create a CSV file which will

contain ItemID and ItemName for some entries. He has written the following code. As a

Sample Question Paper/CSC-XII/SET-I Page 13 of 14


good friend of Robin, help him to execute the following code successfully:

import csv

def AddItem(ItemID, ItemName):

fin=open(“Item.csv”,__________) #Line 1

csvw=csv.writer(fin)

csvw.writerow([ItemID,ItemName])

fin.close()

def readcontents():

fout=open(“Item.csv”,”r”)

csvr=csv.__________(fout) #Line 2

for rec in csvr:

print(rec[0],rec[1])

fout._____________() #Line 3
1
i) In which mode he should open the file in function AddItem() in Line 1.
1
ii) Which function is required to be used in Line 2 and Line 3.
2
iii) How to perform the following operation?

• to call the function AddItem() to add an item detail 101, “Sofa” .

• to display the entire content of the CSV file by calling the function readcontents().

Sample Question Paper/CSC-XII/SET-I Page 14 of 14

You might also like