0% found this document useful (0 votes)
24 views

Rt 12 CS RevisionPapers2025

The document is an examination paper for Class XII Computer Science at D.A.V. Public School, consisting of 37 questions divided into five sections with varying marks. It includes general instructions for answering the questions, which are all compulsory with some internal choices. The paper covers topics related to Python programming, SQL queries, and data handling, with a total maximum score of 70 marks.

Uploaded by

davpalwalexam
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)
24 views

Rt 12 CS RevisionPapers2025

The document is an examination paper for Class XII Computer Science at D.A.V. Public School, consisting of 37 questions divided into five sections with varying marks. It includes general instructions for answering the questions, which are all compulsory with some internal choices. The paper covers topics related to Python programming, SQL queries, and data handling, with a total maximum score of 70 marks.

Uploaded by

davpalwalexam
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/ 121

D.A.V.

PUBLIC SCHOOL
62/4 Mathura Road ,Palwal
Name of the Exam – Revision Test-II Class – XII
Subject – Computer Science Date -27-12-2024
Time Allowed – 3 Hours Day – Friday
Total No. of Questions -37 Max. Marks –70
General Instructions

● This question paper contains 37 questions.


● All questions are compulsory.However,internal choices have been provided in some
questions. Attempt only one of the choices in such questions
● The paper is divided into 5Sections-A,B,C,D and E.
● Section A consists of 21 questions (1to21).Each question carries 1 Mark.
● Section B consists of 7 questions (22to28).Each question carries 2 Marks.
● Section C consists of 3questions (29to31).Each question carries 3 Marks.
● Section D consists of 4 questions (32to35).Each question carries 4 Marks.
● Section E consists of 2 questions (36to37).Each question carries 5 Marks.
● All programming questions are to be answered using Python Language only.
● In the case of MCQ,the text of the correct answer should also be written.
Q Question Marks
No
SECTIONA
1 State True or False: 1
“In a Python loops can also have else clause”
2 What is the output of the following code?
Arguments are used to pass the reference
of a variabl

2. Find the output of the following code.

Name="PythoN3@1" R="

for x in range(len (Name)):

if Name [x].isupper():

R-R+Name[x].lower()

elif Name [x].islower():

R=R+Name[x].upper()

elif Name [x].isdigit():

R-R+Name[x-1]

else:

R=R+"#"
print(R)

(a) PYTHOn##@

(b) pYTHOnN#@

(c) pYTHOn#@

(d) pYTHOnN@#

3 t1=(9,6,7,6) 1
t2=(2,8,12,20)

The output of the statement below is

print(min(t1) + max(t2))

(a) 26 (b) 25 (c) Error (d) None of these


4 Given: s="ComputerExam". 1
What will be the output of print
(s[2]+s[8]+s[1:5])?
(a) Meomuu (b) mEompu (c) mEomPU (d) MEompu
s=s.split('2')
print(s)
a. ['Questionpaper','0','','-','3']
b. ('Questionpaper','0','','-','3')
c. ['Questionpaper','0','2','','-','3']
d. ('Questionpaper','0','2','','-','3')
5 Whatwillbetheoutputoffollowingcodeif a = 1
“abcde”
a[1:1]==a[1:2]
type(a[1:1])==type(a[1:2])
6 Select the correct output of the code: 1
a = "foobar"
a=a.partition("o")
print(a)
(a) ["fo","","bar"]
(b) ["f","oo","bar"]
(c) ["f","o","bar"]
(d) ("f","o","obar")
7 State whether the following statementisTrueorFalse: 1
Anexceptionmayberaisedeveniftheprogramissyntacticallycorrect.
8 1
Identifytheoutputofthefollowingpythoncode: 1
D={1:"one",2:"two",3:"three"
} L=[]
fork,vinD.items():
if 'o' in v:
L.append(k)
print(L)

(a)[1,2] (b) [1,3] (c)[2,3] (d)[3,1]


9 Which of the following is not a tuple in python? 1

(a)(10,20) (b)(10,) (c) (10) (d)All are tuples.

10 1
Which of the following is the correct usage for tell() Of af ile object?

a) Itplacesthefilepointeratthedesiredoffsetina file.
b) Itreturnsthebyte positionof thefilepointerasaninteger.
c) Itreturnstheentirecontentof the file.
d) Ittellsthedetailsaboutthe file.
11 WhatwillbetheoutputofthefollowingPythoncodesnippet? d1 = 1
{"john":40, "peter":45}
d2={"john":466,"peter":45}
d1 > d2
a. True b. False
c. Error d.None
12 Considerthecodegivenbelow: 1
b=5
def myfun(a):
#missingstatement.
b=b*a
myfun(14
) print(b)

Whichofthefollowingstatementsshouldbegivenintheblankfor# Missing
statement, if the output produced is 70?
a. globala b. global b=70
c.globalb d. global a=70
13 Which of the following commands is not a DDL command? 1

(a) DROP (b) DELETE (c) CREATE (d) ALTER

14 Which of the following keywords will you use in the following query to 1
display the unique values of the column dept_name?
SELECT--------------------dept_name FROM Company;
(a)All (b)key (c) Distinct (d) Name
15 What is the maximum width of numeric value in data type int of MySQL? 1
a.10 digits b.11digits
c.9digits d.12digits
16 SUM(),AVG() and COUNT() are examples of functions. 1
a) Single row functions
b) Aggregate functions
c) Math function
d) Date function

17 Is a standard mail protocol used to receive emails from are mote server 1
To a local email client.

(a) SMTP (b)POP (c)HTTP (d)FTP

18 Pawan wants to transfer files and photos from laptop to his mobile.He uses 1
BluetoothTechnology to connect two devices.Which type of networkwill be
formed in this case.
a. PAN b. LAN
c. MAN d.WAN
19 Fill in the blank: 1
In case of switching, message is send in stored and forward manner from
sender to receiver.
Q20 and 21 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 isTrue but R is False
(d) A is false but R is True
20 Assertion(A):The defaultargumentvaluesinPythonfunctionscanbemutable types 1
like lists and dictionaries.
Reason(R):Mutabledefaultargumentsretaintheirstateacrossfunctioncalls, which
can lead to unexpected behaviour.

21 Assertion(A):The HAVING clause in My SQL is used to filter records after the 1


GROUP BY operation.
Reason(R):The WHERE clause filters records before grouping,while HAVING
allows for conditions on aggregated data.

SECTIONB

22 Write difference between mutable and immutable property,Explain it with 2


its example.

23 Predict the output ofthePython 2


code given below:
T= (9,18,27,36,45,54)
L=list(T)
L1 = [ ]
For I in L:
if i%6==0:
L1.append(i)
T1=tuple(L1)
print(T1)
24 Write the Python statement for each of the following tasks using 2
BUILT-IN functions/methods only:
(i) To insert an element 400 at the fourth position,in the list L1.
(ii) To check whether a string named, message ends with a full stop/
period or not.
OR

A list named employee salary stores salary of employees. Write the Python
command to import the required module and (using built-in

function)todisplay the most common salary value from the given list.
25 Whatpossibleoutputsareexpectedtobedisplayedonthescreenatthetimeof execution 2
of the program from the following code?
import random
temp=[10,20,30,40,50,60]
c=random.randint(0,4)
for i in range(0, c):
print(temp[i],”#”)
a) 10#20# b)10#20#30#40#50#
c)10#20#30# d)50#60#
26 Explain the following with help of example. 2
1. Primary Key
2. Candidate key
27 Ms. Rajni has just created a table named “Customer” containing columns 2
Cname, Department and Salary.
Aftercreatingthetable,sherealizedthatshehasforgottentoadda
primarykeycolumninthetable.HelpherinwritinganSQLcommandto add a
primary key column Custid of integer type to the table Customer.
Thereafter, write the command to insert the following record in thetable:
Custid- 555
Cname- Nandini
Department:Management
Salary- 45600
OR
ManishisworkinginadatabasenamedCCA,inwhichhehascreatedatable named
“DANCE” containing columns danceID, Dancename, no_of_participants,
and category.
After creating the table, he realized that the attribute, category has to be
deletedfromthetableandanewattributeTypeCCAofdatatypestringhas to be
added. This attribute TypeCCA cannot be left blank. Help Manish to write
commands to completeboth the tasks.
28 (i) Expand the following terms: 1+1=2
XML, SMTP
(ii) Give the difference between XML and HTML.

OR
(i) Define the term baudwith respect to networks.
(ii) How is http different from https?

SECTIONC
29 Writeauser–definedfunctioncountH()inPythonthatdisplaysthenumber of lines 3
starting with ‘H’ in the file ‘Para.txt”. Example , if the file contains: Whose
woods these are I think I know.
Hishouseisinthevillagethough; He
will not see me stopping here
Towatchhiswoodsfillupwithsnow. Output:
The line count should be 2.
OR
Writeafunctioncountmy()inPythontoreadthetextfile“DATA.TXT”and count
the number of times “my” occurs in the file. For example , if the file
“DATA.TXT” contains –
“Thisismywebsite.IhavedisplayedmypreferenceintheCHOICE section.” The
countmy( ) function should display the output as:
“myoccurs 2 times”
30 3
Aalam has created a list, L containing marks of 10 students. Write a
program,withseparateuserdefinedfunctiontoperformthefollowing operation:
3

PUSH()-Traversethecontentof theList,Landpushalltheoddmarksinto the


stack,S.

POP()-Popanddisplaythecontentofthestack.

Example:Ifthecontentofthelistisasfollows: L=[87, 98,


65, 21, 54, 78, 59, 64, 32, 49]
Thentheoutputofthecodeshouldbe:4959216587

31 3
ConsiderthetableACTIVITYgivenbelow:
Acode Activityna Me Particip Ants Prizemoney Scheduled Te
Num

1001 RelayName 16 10000 2004-01-23


1002 HighJump 10 12000 2003-12-12
1003 ShotPut 12 8000 2004-02-14
1005 Long Jump 12 9000 2004-01-01
1008 DiscussThrow 10 15000 2004-03-19
Based on the given table,write SQL queries for the following:
(i) Display the details of all activities in which prize money is more
than 9000 (including 9000)
(ii) Increase the prize money by 5% of those activities whose schedule
date is after 1stof March 2023.
(iii) Deletetherecordofactivitywhereparticipantsarelessthan12.
SECTIOND

32 YouhavelearnthowtousemathmoduleinClassXI.Writeacodewhereyou 4
usethewrongnumberofargumentsforamethod(saysqrt()orpow()).Use
theexceptionhandlingprocesstocatchtheValueErrorexception.
33 Writeapythonprogramtocreateacsvfiledvd.csvandwrite10recordsinit 4
Dvdid,dvdname,qty,price.Displaythosedvddetailswhosedvdpriceis more
than 25.

34 Considerthefollowingtablesandanswerthequestionsaandb: 1*4=4
Table:Garment
GCode GName Rate Qty CCode

G101 Saree 1250 100 C03


G102 Lehanga 2000 100 C02
G103 Plazzo 750 105 C02
G104 Suit 2000 250 C01
G105 Patiala 1850 105 C01
Table:Cloth
CCode CName
C01 Polyester
C02 Cotton
C03 Silk
C04 Cotton-Polyester

Write SQL queries for the following:


i. Display unique quantities of garments.
ii. Display sum of quantities for each CCODE whose numbers of
records are more than 1.
iii. Display GNAME,CNAME,RATE whose quantity is more
than 100.
iv. Display a veragerate of garment whose rate ranges from 1000
to 2000 (both values included)
35 Kishan wants to write a program in Python to insert the following record in the 4
table named Flight in MYSQL database KV:
● Flno(Flight number)-varchar
● Source(source)-varchar
● Destination(Destination)-varchar
● Fare(fare)-integer
Note the following to establish connectivity between Python and MySQL:
● Username-root
● Password–KVS@123
● Host-localhost
The values of fields Flno,Source,Destination and F are has tobe accepted
from the user. Help Kishan to write the program in Python.
OR
Suman has created a table named Game in MYSQL database Sports:
● GID (GameID)-integer
● Gname (Gamename)-varchar
● No_of_Participants(number of participants)-integer
Note the following to establish connectivity between Python and
MySQL:
● User name:root
● Password:KVS@123
● Host: localhost
Suman, now wants to display the records of students whose number of
participants are more than10,Help Suman towrite the program inPython.
SECTION-E
36 WriteaprograminPythonthatdefinesandcallsthefollowingfunctions: 5
Insert()–Toacceptdetailsof clockfromtheuserandstoresitinacsvfile
‘watch.csv’. Each record of clock contains following fields – ClockID,

ClockName,YearofManf,Price.Functiontakesdetailsofallclocksand
stores them in file in one go.
Delete()–ToacceptaClockIDandremovestherecordwithgivenClockID
fromthefile‘watch.csv’.IfClockIDnotfoundthenitshouldshowarelevant
message.Beforeremovingtherecorditshouldprinttherecordgetting
removed.
37 Superior Education Society is an educational Organization.It is planning to 1*5=5
setup its Campus at Nagpur with its head office at Mumbai.The Nagpur
Campus has 4 main buildings – ADMIN, COMMERCE, ARTS and
SCIENCE. You as a network expert have to suggest the best network related
solutions for their problems raised in a toe,keeping in mind the distances
between the buildings and other given parameters:

Shortest distances between various buildings:


ADMIN to COMMERCE
-55m
ADMIN to ARTS -90m
ADMIN to SCIENCE - 50 m
COMERCE to ARTS - 55 m
COMMERCE to SCIENCE - 50
ARTS to SCIENCE- 45 m
MUMBAI Head Office to NAGPUR Campus–850KM
Number of Computers installed at various buildings are as follows:
ADMIN 110
COMMERCE–75
ARTS – 40
SCIENCE 12
MUMBAIHeadOffice–20
a. Suggest the most appropriate location of the server inside the
Nagpur Campus to get the best connectivity for maximum number
of computers. Justify your answer.
b. Suggest and draw the cable layout to efficiently connect various
buildings within the Nagpur campus for connecting the computers.
c. Which of the following will you suggest to establish the online
face- to-face communication between the people in the ADMIN
office of Nagpur Campus and Mumbai Head office?
i. Cable TV
ii. E-mail
iii. Video Conferencing
iv. Text Chat
d. Suggest the placement of following devices with appropriate reasons:
i. Switch/Hub
ii. Repeater
e. Suggest the device/software to be installed in Nagpur Campus
to take care ofdata security and unauthorized access.
OR
Which network type is formed between Nagpur office to Mumbai
head office.
KENDRIYAVIDYALAYASANGATHAN
JAIPUR REGION
PRACTICEPAPER-I
CLASS XII
SUBJECT:COMPUTERSCIENCE(083)
Time allowed: 3 Hours MaximumMarks:70
MARKING SCHEME

Que Question Marks


s
No
SECTIONA
1 True 1
2 (A)hAPPY#HOUR1122#33 1
3 (b)False 1
4 (a)['Questionpaper','0','','-','3'] 1
5 True 1
6 (d) ("f","o","obar") 1
7 True 1
8 (a)[1,2] 1
9 (c)(10) 1
10 (b)Itreturnsthebytepositionof thefilepointerasan integer. 1
11 b.Error 1
12 c.globalb 1
13 (b)DELETE 1
14 b.distinct 1
15 b.10 digits 1
16 (b)aggregatefunctions 1
17 (b)POP-POSTOFFICEPROTOCOL 1
18 a.PAN 1
19 message 1
20 (A) 1
21 (A) 1
SECTION-B
22 Mutable:Canbechanged(e.g.,lists, dictionary). 2
Immutable:Cannotbechanged(e.g.,tuples,string).
23 (18,36,54) 2
24 WritethePythonstatementforeachofthefollowingtasksusingBUILT-IN 2
functions/methods only:
(i) L1.insert(3,400)
(ii) message.endswith('.')
OR
import statistics
print(statistics.mode(employeesalary))
25 a) 10#20# or b)10#20#30#40#50# or c)10#20#30# 2
26 PrimaryKey:Auniqueidentifierforatable,ensuringnoduplicateorNULLvalues. 2
(Example: StudentID)
CandidateKey: A set ofcolumns that can uniquelyidentifyrecords, fromwhich the
primarykeyisselected.(Example:StudentID,aadharno,admissionno.etc)
27 Altertablecustomeraddcustidintegerprimarykey; 2
Insert into customer
values(‘Nandini’,’Management’,45600,555);
OR
Altertabledancedropcategory;
Altertabledanceaddtypeccavarchar(10)notnull;
28 (i) eXtensibleMarkupLanguage,SimpleMailTransferProtocol 1+1=2
(ii) HTML(HypertextmarkUplanguage)
We use pre-defined tags
Staticwebdevelopmentlanguage –onlyfocusesonhowdata looks
It use for only displaying data, cannot transport data
NotcasesensitiveXML(ExtensibleMarkupLanguage) we
can define our own tags and use them
Dynamicwebdevelopmentlanguage–asitisusedfor transporting
and storing data
Casesensitive
OR
(i) Baudisthenumberbitscarryinginonesecond.
(ii) https (Hyper Text Transfer Protocol Secure) is the protocol that
usesSSL(SecureSocketLayer)toencryptdatabeingtransmitted over
the Internet. Therefore,
httpshelpsinsecurebrowsingwhilehttpdoesnot.
SECTION-C
29 def countH(): 3
f=open(‘Para.txt’,’r’)
rec=f.readlines()
count=0
forline inrec:
ifline[0]==’H
’: count+=1
print(‘Thelinecount=’,count)
f.close()
( ½markforcorrectlyopeningandclosingthefile
½forcorrect loop
1forcorrectcondition
½forcorrectifstatement
½forcorrectlyincrementingcount
)

Note:Anyotherrelevantandcorrectcodemaybe marked
OR
def countmy():
f=open(‘DATA.TXT’,’r’)
rec=f.read()
words=rec.split()
for w in words:
if
w==’my’
:
count+=1
print(‘myoccurs’,count,’times’
) f.close()
( ½markforcorrectlyopeningandclosingthefile
½forcorrect loop
1forcorrectcondition
½forcorrectifstatement
½forcorrectlyincrementingcount
30 def PUSH(S): 3

foriin L:
if i%2! =0:
S.append(i)
return(S)
def POP ():
num=len(S)
whilelen(S)!=0:
dele=S.pop()
print(dele)
num=num-1
else:
print("empty")
31 Basedonthegiventable,writeSQLqueriesforthefollowing:
(i) Select*fromactivitywhereprizemoney>=9000;
(ii) Updateactivitysetprizemoney=prizemoney*1.05
where scheduledate>’2004-03-01’;
(iii) Deletefromactivitywhereparticipantsnum<12
SECTION-D
32 importmath 4
try:
result=math.pow(2,3,4,5)#pow()expects2arguments, # but 4
are provided
exceptTypeError:
print("TypeErroroccurredwithmath.pow()")
else:
print("Result:",result)
try:
result=math.sqrt(9,2)#sqrt()expects1argument, # but
2 are provided
exceptTypeError:
print("TypeErroroccurredwithmath.sqrt()")
else:
print("Result:",result)
33 import csv 4
f=open("pl.csv","w")
cw=csv.writer(f)
ch="Y"
whilech=="Y":
l=[]
pi=int(input("enter dvd id "))
pnm=input("enter dvd name ")
sp=int(input("enterqty"))p=int(input("enter
price(in rupees)"))
l.append(pi)
l.append(pnm)
l.append(sp)
l.append(p)
cw.writerow(l)
ch=input("doyouwanttoentermorerec(Y/N):").upper() if
ch=="Y":
continue
else:
break
f.close()

f=open("pl.csv","r+")
cw=list(csv.reader(f))
for i in cw:
ifl[3]>25:
print(i)
f.close()
34
i. SELECTDISTINCTQtyFROM garment;
ii. SELECTSUM(Qty)FROMgarmentGROUPBYCCode
HAVING COUNT(*)>1;
iii. SELECTGNAME,CNAME,RATEfromgarmentg,clothc
WHERE g.ccode=c.ccode AND Qty>100;
iv. SelectAVG(Rate)FROMgarment
WHERErateBETWEEN1000AND2000;
35 (i) import mysql.connector 4
mycon=mysql.connector.connect(host=’localhost’,
user=’root’, passwd=’KVS@123’,databse=’KV’)
mycur=mycon.cursor()
fn=input(“Enterflightnumber”)s=input(“Enter
source’)
d=input(“EnterDestination”)f=int(input(“Enter
fare of flight”))
query=”insertintoflightvalues(‘{}’,’{}’,‘{}’,{}).format(fn,s,d,f)
mycur.execute(query)
mycon.commit()
print(“Dataaddedsuccessfully”)
mycon.close()
½ mark for importing correct module 1 mark for correct connect() ½ mark for
correctlyacceptingtheinput1½markforcorrectlyexecutingthequery½mark for
correctly using commit() )
OR
(i) import mysql.connector
mycon=mysql.connector.connect(host=’localhost’,
user=’root’,passwd=’KVS@123’,databse=’Sports’
) mycur=mycon.cursor()
query=”select*fromgame
whereNo_of_Participants>{}”.format(10)mycur.execute(query)
data=mycur.fetchall()
forrecindata: print(rec)
mycon.close()
(½markforimportingcorrectmodule1markforcorrectconnect()
1markforcorrectlyexecutingthequery½markforcorrectlyusingfetchall() 1 mark
for correctly [15] displaying data)
SECTION-E
36 defInsert(): 5
L=[]
whileTrue:
ClockID = input("Enter Clock ID = ")
ClockName=input("EnterClockName=")
YearofManf=int(input("EnterYearofManufacture="))
price = float(input("Enter Price = "))
R=[ClockID,ClockName,YearofManf,price]
L.append(R)
ans=input("Doyouwanttoentermorerecords(Y/N)=")

if ans.upper()=='N':
break
importcsv
fout=open('watch.csv','a',newline='')
W = csv.writer(fout)
W.writerows(L)
fout.close()
print("Recordssuccessfullysaved") def
Delete():
ClockID=input("EnterClockIDtoberemoved=") found
= False

import csv
fin=open('watch.csv','r')
R = csv.reader(fin)
L=list(R)
fin.close()
for i in L:
Ifi[0]==ClockI
D:
found=True
print("Recordtoberemovedis:")
print(i)
Remove(i)
break
if found==False:
print("Recordnotfound")
else:
fout=open('watch.csv','w',newline='')
W = csv.writer(fout)
W.writerows(L)
fout.close()
print("RecordSuccessfullyRemoved")

Insert()function
½markforcorrectdatainputandmakinglist
½markforcorrectlyopeningfile
1½ mark for correctly writing
record Delete() function
½markforcorrectlycopyingdata inlist
½markforcorrectlyidentifyingrecordandremovingitfromthelist
½markforcorrectlyshowingnotfoundmessage 1
mark for correctly re-writing remaining records
37 a.ThemostsuitablebuildingtohousetheserverisADMINbuildingbecause 1*5=5
ithasmaximumnumberofcomputersandasper80:20rulethisbuilding will
have the maximum amount of network traffic.
½markforcorrect answer
½markforcorrect justification
b.
1markforcorrectdiagram
c. iii.VideoConferencing
1markforcorrectdiagram
d.
i. Switch/Hubwillbeplacedineverybuildingtoprovidenetwork
connectivity to all devices inside the building.
ii. Repeaterwillnotberequiredasthereisnotcablerunningfor more
than 100 meters.
½markeachforeachcorrectreason
e.Thedevice/softwarethatcanbeinstalledfordatasecurityandto protect
unauthorized access is Firewall.
Or
WAN
1markforcorrectanswer
अनुक्रमTांक/ROLLNO

केंद्रीयविद्य T लयसांगठन,जयपुरसांभTग
KENDRIYAVIDYALAYASANGATHAN,JAIPURREGION
PRACTICEPAPER-II
कक्ष T/CLASS:XII
विषय/SUB:कांप्यूटरविज्ञTनां(83)/COMPUTERSCIENCE(83)
अविकतमअिवि/TimeAllowed:03Hours अविकतमअांक MaximumMarks:70
स T म T न्यवनर्देश/GeneralInstructions

1. Thisquestionpapercontainsfivesections,SectionAtoE.
2. Allquestionsare compulsory.
3. SectionAhas21questions(1to21)carrying01markeach.
4. SectionBhas07VeryShortAnswertypequestions(22to28)carrying02markseach.
5. SectionChas03ShortAnswertypequestions(29to31)carrying03markseach.
6. SectionDhas04LongAnswertypequestions(32to35)carrying04markseach.
7. SectionEhas02questions(36to37)carrying05markseach.
8. AllprogrammingquestionsaretobeansweredusingPythonLanguageonly.
9. IncaseofMCQ,textofthecorrectanswershouldalsobe written.

SECTION-A(21*1=21Marks)
Q.No Question Marks
1. StateTrueor False 1
“continuekeywordskipsremainingpartofaniterationinaloop”
2. Selectthecorrectoutputofthecode: 1
>>>St=”Computer”
>>>print(St[4:])
(a) “Comp” (b) “pmoC” (c)“uter” (d) “mput”
3. 1
print(TrueornotTrueand False)
Chooseoneoptionfromthefollowingthatwillbethecorrectoutputafter executing the
above python expression.
a) False b) True c) or d) not
4. Giventhefollowingdictionaries 1
dict_stud={"rno":"53","name":‘RajveerSingh’}
dict_mark = {"Accts" : 87, "English" : 65}
Whichstatementwillmergethecontentsofbothdictionaries?
(a)dict_stud+dict_mark (b)dict_stud.add(dict_mark)
(c)dict_stud.merge(dict_mark) (d)dict_stud.update(dict_mark)
5. ConsideradeclarationL=(1,’Python’,’3.14’) 1
WhichofthefollowingrepresentsthedatatypeofL?
(a) list (b) tuple (c)dictionary (d)string
6. Givenatupletupl=(10,20,30,40,50,60,70,80,90) What 1
will be the output of print (tupl[3:7:2])?
(a)(40,50,60,70,80) (b)(40,50,60,70) (c)[40,60] (d) (40,60)
7. WhenaPythonfunctiondoesnothavereturnstatementthenwhatitreturns? 1
(a)int (b) float (c)None (d)Give Error
8. Whatwillthefollowingexpressionbeevaluatedtoin Python? 1
1|Page
2|Page
print(2**3**2)
a) 64 b) 256 c) 512 d) 32
9. Whichofthefollowingstatement(s)wouldgiveanerrorafterexecutingthe following 1
code?
S="Welcome to class XII" #Statement 1
print(S) # Statement2
S="Thankyou" #Statement3
S[0]='@' #Statement4
S=S+"Thankyou" #Statement5
(a) Statement3 (b) Statement4
(c) Statement5 (d)Statement4and5
10. Whichofthefollowingoptionisthecorrectpythonstatementtoreadanddisplay the first 1
10 characters of a text file “Notes.txt”?
(a) F=open(‘Notes.txt’) (b)F=open(‘Notes.txt’)
print(F.load(10)) print(F.dump(10))

(c) F=open(‘Notes.txt’) (d)F=open(‘Notes.txt’)


print(F.read(10)) print(F.write(10))
11. WhichPythonapproachisusedforobjectserializationinhandlingofBinaryFile? 1
(a)Pickling (b)Un-pickling (c)Merging (d)Noneofthese
12. Inthegivenprogram,identifywhicharelocalandglobal variables? 1

def change():
n=10
x=5
print(x)
a)nandxbotharelocalvariables b)nandxbothareglobal variables
c)nisglobalandxislocalvariable d)nislocalandxisglobal variable
13. Fillintheblank: 1
commandisusedtoaddacolumninatableinSQL.
14. KeywordisusedtoobtainNon-duplicatedvaluesinaSELECT query. 1
(a)ALL (b) DISTINCT (c)SET (d) HAVING
15. WhichSQLfunctionreturnsthesumofvaluesofacolumnofnumerictype? 1
(a)total( ) (b)add( ) (c) sum( ) (d) All of these
16 Whichofthefollowingisnotvalidcursorfunctionwhileperformingdatabase operations 1
using python. Here Mycur is the cursor object?
(a)Mycur.fetch() (b)Mycur.fetchone()
(c)Mycur.fetchmany(n) (d)Mycur.fetchall()
17. WhatModemdoes? 1
a)Modulation (b)Demodulation
c) BothModualtion&Demodulation (d)Notany
18. Fillintheblank: 1
isthefirstpagethatnormallyviewata website.
(a)FirstPage (b)MasterPage (c)HomePage (d)LoginPage
19. Fillintheblank: 1
isthewayofconnectingthenetworkingdevices.
Q20andQ21areASSERTIONANDREASONINGbyasedquestions.Markthecorrectchoiceas
3|Page
(a)BothAandRaretrueandRisthecorrectexplanationforA

4|Page
(b) BothAandRaretrueandRisnotthecorrectexplanationforA
(c) AisTruebutRisFalse
(d) AisfalsebutRisTrue
20. Assertion(A):Avariabledeclaredasglobalinsideafunctionisvisible outside the 1
function with changes made to it inside the function.
Reasoning(R):globalkeywordisusedtochangethevalueofaglobalvariable.

21. Assertion(A):COUNT(*)functioncountthenumberofrowsinarelation. Reasoning 1


(R):DISTINCTignores the duplicate values.

SECTION-B(7*2=14Marks)
22. Whichof thefollowingcanbeusedasvalididentifier(s)in Python? 2
(i)Total (ii)@selute (iii) Que$tion (iv)great
(v)4thSem (vi)li1 (vii) No# (viii)_Data
23. (i)Writethenamesof anytwodatatypesavailableinpython. 1+1=2
(ii)Writeany2operatorsnameusedin python.
24. WritethePythonstatementforeachofthefollowingtasksusingBUILT_IN functions/ 1+1=2
methods only:
i) str="PYTHON@LANGUAGE"
(A) Toprinttheabovestringfromindex2onwards.
OR
(B) Toinitializeanemptydictionarynamedasd.

ii) WritethePython statementforeachofthefollowingtasksusingBUILT_IN


functions/ methods only:
(A) s=”LANGUAGE"
Toconverttheabovestringintolist.
OR
(B) Toinitializeanemptytuplenamedas t.
25. Findpossibleo/p(s)atthetimeofexecutionoftheprogram fromthefollowingcode? Also 2
specify the maximum values of variables Lower and Upper.
import random as
rAR=[20,30,40,50,60,70];
Lower=r.randint(1,3)
Upper=r.randint(2,4)
forKinrange(Lower,Upper+1): print
(AR[K],end=”#“)
(i)10#40#70# (ii)30#40#50#
(iii)50#60#70# (iv)40#50#70#
26. DifferentiatebetweenCOUNT(*)andCOUNT(COLUMN_NAME)withexample. 2
27. (i) 2
A) Whatconstraintshouldbeappliedonatable’scolumntoprovideitthe default
value when column does not have any value.
OR
B) What constraint should be applied on a table’s column so that NULL
valueisallowedinthatcolumnandduplicatevaluesarenotallowed.

(ii)
A) WriteanSQLcommandtoaddonemorecolumninpreviouslydefined table,
named CELL. Column name is CELL_ID with size 10 of integer type
should be added in the table.
5|Page
OR
B) WriteanSQLcommandtopermanentlyremovethe tableCELLfrom
database.

6|Page
28. A) Writethefullformsof theURLandVoIPandtheirutility? 2
OR
B) MentionanytwodifferencesbetweenIPandMACaddressinnetworking.
SECTION-C(3*3=9 Marks)
29. A) Writeamethod/function countlines_et()inpythontoreadlinesfromatextfile 3
report.txt, and COUNT those lines which are starting either with ‘E’ and starting
with ‘T’ respectively. And display the Total count separately.
Forexample:ifREPORT.TXTconsistsof
“THEPROGRAMMINGISFUNFOR PROGRAMMER.
ENTRYLEVELOFPROGRAMMINGCANBELEARNEDFROMUSEFULFOR
VARIETY OF USERS.”
Then,
Outputwillbe:No.ofLineswithE:1 No.ofLineswithT:1
OR
B) Write a method/function show_todo():in python to read contents from a
textfileabc.txt and display those lines which have occurrence of the word “ TO” or
“DO”
Forexample:
Ifthecontentofthefileis
“THISISIMPORTANTTONOTETHATSUCCESSIS THERESULTOFHARDWORK.
WEALLAREEXPECTEDTODOHARDWORK.
AFTERALLEXPERIENCECOMES FROM HARDWORK.”

Themethod/functionshoulddisplay:
THISISIMPORTANTTONOTETHATSUCCESSISTHERESULTOFHARDWORK.
WE ALL ARE EXPECTED TO DO HARD WORK.
30. A) 3
A list of numbers is used to populate the contents of a stack using a function
push(stack,data)wherestackisanemptylistanddataisthelistofnumbers.The function
should push all the numbers that are even to the stack.

Writethefunctionpop(stack)thatremovesthetopelementofthestackonitseach call.

Alsowritethefunctioncalls.
OR

B)
Write a function in Python push(EventDetails) where EventDetails is a dictionary
containing the number of persons attending the events–
{EventName: NumberOfPersons}.

Thefunctionshouldpushthenamesofthoseeventsinthestacknamed‘BigEvents’
whichhavenumberofpersonsgreaterthan200.Alsodisplaythecountofelements pushed
on to the stack.

Write the function pop(EventDetails) that removes the top element of the stack on
its each call.

Alsowritethefunctioncalls.

For example:

7|Page
If the dictionary contains the following
data:EventDetails={“Marriage”:300,“GraduationParty”:
1500,
“BirthdayParty”:80,“Gettogether”:150}
The stack should contain :-

8|Page
Marriage
GraduationParty

Theoutputshouldbe:
Thecountofelementsinthestackis2
31. Mohanisaseniorclerkina MNC.Hecreatesatablesalarywithasetofrecordsto keep ready for 3
tax calculation. After creation of the table, he has entered data of 5 employees in the
Employee table.

BasedonthetablegivenabovewritetheSQLQueries:
A)
(i) ToDisplaytheEmp_NameandGross_salaryofeachemployee.
(Gross= basic+da+hra+nps)
(ii) ToIncreasetheDAby3%ofrespectivebasicsalaryofall
employees.
(iii) ToDeletetheAttributeemp_desigfromthetable.

OR
B)
(i) Todisplaythetotal numberofemployeesinEmployee table.
(ii) Todisplaytheemployeesrecordsindescendingorderof
basic_salary respectively.
(iii) TodisplaythetotalhraofemployeesinEmployee table.

SECTION-D(4*4=16Marks)
32 A) 1+3=4
i) WhenisIndexErrorExceptionraisedinPython?

ii) Give an example code to handleIndexError? The code should display the
message“listindexoutofrangeisnotallowed”incaseofIndexErrorException, and the
message “Some Error occured”in case of any other Exception.
OR
B)
i) WhenisZeroDivisionErrorExceptionraisedinPython?

ii) Write a function division( ) that accepts two arguments. The function should be
abletocatchanexceptionsuchasZeroDivisionErrorException,andthemessage
“SomeErroroccured”incaseofanyotherException.

9|Page
33 AmanhasrecentlybeengivenataskonCAPITAL.CSVwhichcontainsCountryand Capital 2+2=4
. as data for records insertion.

ForExample: “INDIA”,“NEW DELHI”


“CHINA”,”BEIJING”
Writepythoncodeforthesetwouserdefinedfunctions:

(i) AddNewRecord():insertionofnewrecordsinfile.
(ii) ShowRecord():todisplayalltherecordsfromfile.

10|
Page
34 Write the SQL queries (i) to (iv) based on the relationsSCHOOL and ADMIN given 4
. below:

WriteSQLqueriesforthefollowing:
i) Displaytotalperiodssubjectwisebyframinggroupsbasedonsubject.
ii) DisplayminimumexperienceandmaximumcodefromrelationSCHOOL.
iii) Displayteachername,genderbyjoiningbothtablesonthebasisofcode ATTRIBUTE
and the designation should be “COORDINATOR.
iv)
(A) Displaythetotalnumberofdifferentsubjectsinschoolrelation.
OR
(B) TodisplaythetotalnumberofMalesandFemalesseparatelywithgenderin
ADMIN table.
35 4
. AaryahascreatedatablenamedEmpinMySQL: EmpNo –
integer
EmpName–string
Age– integer
Salary – integer
Notethefollowingto establishconnectivitybetweenPythonandMYSQL:
● Username -root
● Password-tiger
● Host- localhost
● TheEmptableexistsinaMYSQLdatabasenamedcompany.
● Thedetails(EmpNo,EmpName,AgeandSalary)aretobeaccepted from
the user.
AaryawantstodisplayAllRecordsofEmprelationwhoseageisgreaterthan55. Help Aarya
to write program in python
SECTION-E(2*5=10Marks)
36 i. WhatisBinaryFile? 1+2+
ii. Consider a binary file stock.dat that has the following data: OrderId, 2=5
MedicineName,Qty and Price of all the medicines of wellness medicos, write the
following functions:
11|
Page
a) AddOrder()thatcaninputallmedicineorders.
b) DisplayPrice()todisplaydetailsofallmedicinethathavePricemorethan 500.

12|
Page
37 HitechInfoLimitedwantstosetuptheircomputernetworkinBangalore based 5
campushavingfourbuildings.Eachblockhasanumberof computers
thatarerequiredtobeconnectedforeaseofcommunication,resourcesharingand data
security.
Youasanetworkexperthavetosuggestanswerstotheseparts(a)to(e)raised by them.

DEVELOPMENT

KV
S
RO
HUMANRESOURCE LOGISTICS

ADM
Shortestdistancesbetweenvariousblocks
BlockDEVELOPMENTtoBlockHUMANRESOURCE-- 50m
Block DEVELOPMENT to Block ADM-- 75 m
BlockDEVELOPMENTtoBlockLOGISTICS-- 80m
BlockHUMANRESOURCEtoBlockADM-- 110m
BlockADMtoBlockLOGISTICS 140 m

Numberofcomputersinstalledatvariousblocks
Block Number of
ComputersDEVELOPMENT -- 105
HUMANRESOURCE-- 130
ADM-- 190
LOGISTICS-- 55

i) Suggestthemostsuitableblocktohosttheserver.Justifyyouranswer.
ii) SuggestthewiredmediumandDrawthecablelayout(BlocktoBlock)to
economically connect various blocks.
iii) Suggesttheplacementofthefollowingdeviceswith justification:
(a) Hub/Switch (b)Repeater
iv) SuggestthedevicethatshouldbeplacedintheServerbuildingsothatthey can
connect to Internet Service Provider toavail Internet Services.
v) A)WhatistheSuggestionforthehigh-speedwiredcommunicationmedium
between Bangalore Campus and Mysore campus to establish a data network.
(a)TWPCable (b)CoAxialCable (c)OFC (d)UTPCable
OR
B)Whattypeof network(PAN/LAN/MAN/WAN)willbesetupamongthe
computers connected in the Campus?

----------------*------------*------------------

13|
Page
KENDRIYAVIDYALAYASANGATHAN,JAIPURREGION PRACTICE
PAPER-II
Class-XII
Subject: Computer Science (083)
MarkingSchemeCumModelAnswer-Sheet

SECTION-A(1*21=21MARKS)
QN Answerof Question
1. Ans.True,ascontinuekeywordskipsremaining partofaniterationina loop. 1

2. Ans.(c)“uter”,asitcountsfrom4indextolast index 1
3. Ans:(b)True,asfirstly“not”performedthen“And”performedandatlast “Or” 1
performed.
TrueornotTrueandFalse True
or False and False True or
False
True
4. Ans.(d)dict_student.update(dict_marks),asweuseupdatemethodfor 1
dictionary merging with syntax dict1.update(dict2)
5. Ans.(b)tuple,asElementsenclosedinparentheses()representsby tuple. 1

6. Ans:(d)(40,60),asthisexpressionwillslicethegiventuplestartingwith 1
indexposition3andselectingeverysecondelementtillindexnumber7.
7. Ans.(c)None,asitisemptyvalue. 1
8. Ans.(c)512,as2**3**2=2**9=512istheanswer. 1
9. Ans.(b)Statement4,asstring’sindividualelementcan’tassignednew value so 1
S[0]= '@'# Statement 4 give error.
10. Ans. (c) F=open(‘Notes.txt’) 1
print(F.read(10))
Asreadmethodinpythonisusedtoreadatmostnbytesfromthefile
associatedwiththegivenfiledescriptor.Iftheendofthefilehasbeen reached
while reading bytes from the given file descriptor, os.read( ) method will
return an empty bytes object for all bytes left to be read.
11. Ans.(a)Pickling,aspicklingisusedforobjectserializationinhandling of 1
Binary Files.
12. Ans.(d)n islocal andxisglobal variable 1
Asnisdefinedwithinfunctionbodyandxisdefinedoutsidethefunction body.

13. Alter-AddcommandisusedtoaddanewcolumnintableinSQL. 1
14. Ans.(b)DISTNICT,asDISTNICTKeywordisusedtoobtainNon- duplicated 1
values in a SELECT query.
15. Ans.(c)sum(),asit’susedforsummationofnumericvaluesina column. 1

16. Ans.(a)Mycur.fetch(), asit’snotavalidmethodforfetching. 1


17. Ans.(c)BothModualtion&Demodulation,asMODEMdoesboth tasks. 1

18. Ans.(c)HomePage,asitisthefirstpagethatnormallyviewata website. 1


19. Ans:Topologyisthewayofconnectingthenetworkingdevices. 1
20. Ans:(a)BothAandRaretrueandRisthecorrectexplanationforA 1
Asglobalvariablesareaccessedanywhereintheprogramandlocal
variables are accessed only within the boundary of loop/ condition/
function.
1|Page
2|Page
21. Ans:b)Both AandRaretrueandRisnotthecorrectexplanationforA 1

SECTION-B(2*7=14MARKS)
22 Valid identifier(s) ½
. (i)Total (iv)great (vi) li1 (viii)_Data *4
Asidentifier(s)namesmaybestartedwithalphabetorunderscore.A digit =2
may be there between the name.

Invalididentifier(s)
(ii)@selute (iii)Que$tion (v)4thSem (vii)No#
Asidentifier(s) name does not have any special character except
underscore.Nameshouldnotstartwithdigitandnotanyspaceisthere
inname.
23 i) Namesofanytwodatatypesavailableinpython:int,floatoranyother valid 1+1
. datatype in python. =2
ii) Any2operatorsnameusedinpython:Arithmetic,Logical,Relational or
any other valid operator in python.
24 (i)A)str="PYTHON@LANGUAGE" 2
. print(str[2::])
OR
B)d=dict()
(ii)A) s=”LANGUAGE"
l=list(s)
OR
B)t=tuple()
25 Lower=r.randint(1,3)meansLowerwillhavevalue1,2,or3 2
. Upper=r.randint(2,4)meansUpperwillhavevalue2,3,or4 So K
will be from (1, 2, 3) to (2, 3, 4)
MeansifK=1,thenupperlimit(2,3,4) If
K=2, then upper limit (2,3,4)
IfK=3,thenupperlimit(2,3,4)
Socorrectanswer(ii)30#40#50#
MaximumvaluesofvariablesLowerandUpperare3and 4.
26 COUNT(*)returnsthecountofallrowsinthetable, 2
. whereas COUNT (COLUMN_NAME) is used with Column_Name
passed as argument and counts the number of non-NULLvalues in the
particular column that is given as argument.
Example:
AMySQLtable,saleshave10rowswithmanycolumns,onecolumn name is
DISCOUNT.
ThisDISCOUNTcolumnhas6validvaluesand4empty/null
values.When we run the Following queries on sales table.
SELECTCOUNT(*)
FROMsales;
COUNT(*)
10

SELECT
COUNT(DISCOUNT)
FROMsales;
COUNT(DISCOUNT)
6
3|Page
As in table,there are10 rows so count(*) gives 10anddiscount
columnishaving6validvalues with4NULLvaluessoitgives6.
27 i) 1+1

4|Page
. A) Defaultconstraintshouldbeappliedona table’scolumntoprovide it the =2
default value when column does not have any value.
OR
B) Uniqueconstraintshouldbeappliedonatable’scolumnsothat NULL
value is allowedin that columnand duplicate values arenot allowed.
ii)
A)
SQLcommandtoaddonemorecolumninpreviouslydefinedtable,
named CELL. Column name is CELL_ID with size 10 of integral
type should be added in the table
AltertableCELL
ADDCELL_ID(10)int;
OR
DROPtableCELL;
28 (A)VOIP-VoiceOverInternetProtocol 2
. Utility-VoIPisusedtotransferaudio(voice)andvideooverinternet
URL- Uniform Resource Locator
Utility-Placefortypingwebsitenamesinwebbrowser.
OR
(B) IPAddress MACAddress
InternetProtocolAddress MediaAccessControlAddress
It is 4 bytes address in IPV4 and Itis6bytesaddress.
6 bytes address in IPV6

Oranyothervaliddifferencebetweenthetwo. (1
mark for ANY ONE difference)
SECTION-C(3*3=9 Marks)
29 A) 3
. def countlines_et():
f=open("report.txt",'r')
lines=f.readlines()
linee=0
linet=0
for i in lines:
ifi[0]=='E'
:
linee+=1
elifi[0]=='T':
linet+=1
print("No.ofLineswithE:",linee)
print("No.of Lines with T:",linet)
countlines_et()

O
R
B)
def show_todo():
f=open("abc.txt",'r')
lines=f.readlines()
for i in lines:
5|Page
if"TO"inior"DO"ini:
print(i)
show_todo()
30 A) 3
.

6|Page
data=[1,2,3,4,5,6,7,8]
stack=[]
defpush(stack,data):
for x in data:
if x % 2 == 0:
stack.append(x)
defpop(stack):
if
len(stack)==0:return
"stackempty"
else:
returnstack.pop()
push(stack,Data)
print(pop(stack)
(½ mark should be deducted for all incorrect syntax.Full marks to
beawarded for any other logic that produces the correct result.)

B)
defpush(EventDetails):
BigEvents=[]
count=0
foriin EventDetails:
if EventDetails[i]>200:
BigEvents.append(i)
count+=1
print(“Thecountofelementsinthestackis”,count) def
pop(EventDetails):
if len(EventDetails)==0:
return"Dictionaryisempty"
else:
returnEventDetails.pop()
push(EventDetails)
print(pop(EventDetails))
(½ mark should be deducted for all incorrect syntax.Full marks to
beawarded for any other logic that produces the correct result.)
31 A) 1*3
(i) SELECTEMP_NAME,BASIC+DA+HRA+NPSAS“GROSS =3
SALARY” FROMEMPLOYEE;
(ii)UPDATEEMPLOYEESET DA=DA+0.03*BASIC;
(iii)ALTERTABLEEMPLOYEEDROPCOLUMNEMP_DESIG;
OR
B)
(i) SELECTCOUNT(*)FROM EMPLOYEE;
(ii) SELECT*FROMEMPLOYEEORDERBYbasic desc;
(iii) SELECTSUM(hra)FROMEMPLOYEE;
SECTION-D(4*4=16Marks)

7|Page
32 A) 1+3
. i)Whenthevaluepassedintheindexoperator isgreaterthantheactual size of the =4
tuple or list, Index Out ofRange is thrown by python.
ii)
value=[1,2,3,4]
data=0
try:
data=value[4]

8|Page
exceptIndexError:
print(“listindexoutofrangeisnotallowed”,end=’’)
except:
print(“SomeErroroccurred”,end=’’)

OR
B)
i) Whenthedivisionormodulobyzerotakesplaceforallnumerictypes,
ZeroDivisionError Exception is thrown by python.
ii)
defdivision(x,y)
: try:
div=x/
yprint(div,end=’
’)
exceptZeroDivisionErrorase:
print(“ZeroDivisionErrorExceptionoccured”,e,end=’’) except:
print(“SomeErroroccurred”,end=’’)
33 importcsv 2+2
. defAddNewRec(Country,Capital): =4
f=open(“CAPITAL.CSV”,’a’
)
fwriter=csv.writer(f)
fwriter.writerow([Country,Capital])f.clos
e()
defShowRec():
withopen(“CAPITAL.CSV”,”r”)asNF:
NewReader=csv.reader(NF)
for rec in NewReader:
print(rec[0],rec[1])
AddNewRec(“INDIA”,”NEWDELHI”)
AddNewRec(“CHINA”,”BEIJING”)
ShowRec()

Output:
INDIANEW DELHI
CHINABEIJING
34 i) SELECTSUM(PERIODS),SUBJECTFROMSCHOOLGROUPBY 1*4
. SUBJECT ; =4

ii) SELECTMIN(EXPERIENCE),MAX(CODE)FROMSCHOOL;

iii) SELECTTEACHERNAME,GENDERFROMSCHOOL,ADMIN
WHERE
DESIGNATION=‘COORDINATOR’AND
SCHOOL.CODE=ADMIN.CODE;
iv)
A) SELECTCOUNT(DISTINCTSUBJECT)FROMSCHOOL;
OR
B) SELECTCOUNT(),GENDERFROMADMINGROUPBY
GENDER;
(1markforeachcorrect query)
9|Page
35 importmysql.connectorascnt def 4
. Emp_Database():
con=cnt.connect(host="localhost",user="root",password="tiger",
database="company")
mycursor=con.cursor()

10|Page
print("DisplayEmployeewhoseageismorethan55years:")
mycursor.execute("select * from Emp where age>55”)
EmpRec= mycursor.fetchall()
forrecin EmpRec:
print(rec)
SECTION-E(2*5=10Marks)
36 BinaryFiles-Itisusuallymuchsmallerthanatextfile.Forimage,video and 1+2
audio data this type of file is important and it’s extension is .det or +2=
.dat.Compilerdoesnotneedtoconvertthesefilesasthesefilesarein the 5
machine readable form hence these files consumes less time to execute
and process faster.
(a)importpickle
defAddOrder():
f=open("Stock.dat",'ab')
OrderId=input("EnterOrderId")
MedicineName=input("EnterMedicineName")
Qty=int(input("Enter Quantity:"))
Price=int(input("Enter Price:"))
data=[OrderId,MedicineName,Qty,Price]
pickle.dump(data,f)
f.close()
AddOrder()
(b)
def DisplayPrice():
f=open("Stock.dat",'rb')
try:
while True:
data=pickle.load(f)
if data[3]>500:
print(data[0],data[1],data[2],data[3],sep="\t")
except:
f.close()
DisplayPrice()
37 i) ADMBlock 1*5
Justification-Ithasmaximumnumberofcomputers.Reducetraffic. =5
ii)wiredmediumisUTP/STPcables

DEVELOPMENT HUMANRESOURCE

LOGISTICS ADM

iii) (a)Switchesinalltheblockssincethecomputersneedtobe
connected to the network.
(b)Repeaters between ADM and HUMANRESOURCE block& ADM
andLogisticsblock.Thereasonbeingthedistanceismorethan100m.
iv) ModemshouldbeplacedintheServerbuilding
v) (c)OFC-OpticalFibercable,thisconnectionishigh-speedwired
communication medium.
OR LANwillbesetupamongcomputersconnectedinCampus.

11|Page
अनुक्रमाांक/ROLLNO सेट/SET:01

केंद्रीयविद्यालयसांगठन,जयपुरसांभाग
KENDRIYAVIDYALAYASANGATHAN,JAIPURREGION
प्रथमप्रीबोर्डपरीक्षा /1STPREBOARDEXAMINATION:2024-25
कक्षा/CLASS:XII
विषय/SUB:कांप्यूटरविज्ञानां(83)/COMPUTERSCIENCE(83)
अधिकतमअिधि /TimeAllowed:03Hours अधिकतमअांक MaximumMarks:70
सामान्यननर्देश/GeneralInstructions

● Thisquestionpapercontains37questions.
● Allquestionsarecompulsory.However,internalchoiceshavebeenprovidedinsome
questions. Attempt only one of the choices in such questions
● Thepaperisdividedinto 5Sections-A,B,C,DandE.
● SectionAconsistsof21questions(1to21).Eachquestioncarries1 Mark.
● SectionBconsistsof7questions(22to28).Eachquestioncarries2 Marks.
● SectionCconsistsof3questions(29to31).Eachquestioncarries3Marks.
● SectionDconsistsof4questions(32to35).Eachquestioncarries4Marks.
● SectionEconsistsof2questions(36to37).Eachquestioncarries5 Marks.
● AllprogrammingquestionsaretobeansweredusingPythonLanguageonly.
● InthecaseofMCQ,thetextofthecorrectanswershouldalsobewritten.

Q. Section-A(21x1 =21 Marks) Mark


1 StateTrueor False: 1
Thekeysofadictionarymustbeof immutable types.
2 Identifytheoutputofthefollowingcode snippet: 1
str="KENDRIYA VIDYALAYA"
str=str.replace('YA','*')
print(str)
(a)KENDRIYAVIDYALAYA (b)KENDRI*AVID*ALAYA
(c)KENDRI*VID*LA* (d)*KENDRI* VID*LA*
3 Whatwillbetheoutputoffollowingexpression? 1
(5<10 ) and (10< 5) or (3<18) and not 8<18
(a) True (b)False (c)Error (d)Nooutput
4 Whatistheoutputoftheexpression? 1
St1=”abc@pink@city”
print(St1.split("@"))
(a)(“abc”,“@”,“pink”,“@”,“city”) (b)[“abc”,“@”,“pink”,”@’,”city”]
(c)[“abc”,“pink”,“city”] (d) Error
5 Whatwillbetheoutputofthefollowingcodesnippet? message= 1
"Satyamev Jayate"
print(message[-2::-2])
6 Whichofthefollowingoptionswillnotresultinanerrorwhenperformedontypesin python 1
where tp = (5,2,7,0,3) ?
(a)Tp[1]=2 (b)tp.append(2)
(c)tp1= tp+tp (d)tp.sum()

Page1of7
7 Ifmy_dictisadictionaryasdefinedbelow,thenwhichofthefollowingstatementswill raise 1
an exception?
my_dict={'aman':10,'sumit':20,'suresh':30}
(a)my_dict.get('suresh') (b)print(my_dict['aman','sumit'])
(c)my_dict['aman']=20 (d) print(str(my_dict))
8 Whichofthefollowingcandeleteanelementfromalistiftheindex oftheelementis given? 1
(a)pop() (b)remove( )
(c)clear() (d)allofthese

9 Whichof thefollowingattributescanbeconsideredasachoiceforprimarykey? 1
(a) Name (b)Street
(c)Roll No (d)Subject
10 Writethemissingstatementtocompletethefollowingcode: file = 1
open("abc.txt", "r")
d =file.read(50)
#Movethefilepointertothebeginningofthefile
next_data=file.read(75)
file.close()
11 StatewhetherthefollowingstatementisTrueorFalse: 1
Anexceptionmayberaisedeveniftheprogramissyntacticallycorrect.
12 WhatwillbetheoutputofthefollowingPythoncode? v = 1
50
def Change(n):
global
vv,n=n,v
print(v,n,sep=“#”,end=“@”) Change(20)
print(v)
(a)20#50@20 (b)50@20#50
(c)50#50#50 (d)20@50#20
13 Whichstatementisusedtomodifydatainatable? 1
(a)CHANGE (b) MODIFY (c)UPDATE (d)ALTER

14 Howwouldyoureturnalltherowsfromatablenamed"Item"sortedindescending order on 1
the column "IName"?
(a) SELECT*FROMItemSORT'IName'DESC;
(b) SELECT*FROMItemORDERBYINameDESC;
(c) SELECT*FROMItemORDERINameDESC;
(d) SELECT*FROMItemSORTBY'IName'DESC;
15 LIKEclauseisused for. 1
(a)Forpatternmatching (b)Fortablematching
(c)Forinsertingsimilardatainatable (d)Fordeletingdatafromatable
16 Count(*)methodcount 1
(a)NULLvalues only (b)EmptyValues
(c)ALLthevalues (d)Noneofthese
17 ThetermHTTPstandsfor? 1
(a)Hyperterminaltracingprogram (b)Hypertexttracingprotocol
(c)Hypertexttransferprotocol (d)Hypertexttransferprogram
18 Adevicethatconnectsnetworkswithdifferentprotocols– 1
(a)Switch(b)Hub(c)Gateway(d)ProxyServer

Page2of7
19 Whichswitchingtechniquefollowsthestoreandforwardmechanism? 1

Q20andQ21areAssertion(A)andReason(R)basedquestions.Markthecorrect choice as:


(a) BothAandRaretrueandRisthecorrectexplanationforA
(b) BothAandRaretrueandRisnotthecorrectexplanationforA
(c) AisTruebutRisFalse
(d) AisFalsebutRis True
20 Assertion:-Aparameterhavingadefaultvalueinthefunctionheaderisknownasa default 1
parameter.
Reason:-Thedefaultvaluesforparametersareconsideredonlyifnovalueis provided for that
parameter in the function call statement.
21 Assertion:-BothWHEREandHAVINGclausesareusedtospecify conditions. Reason :-
The WHERE and HAVING clauses are interchangeable.

Q Section-B(7x2=14Marks) Mark
22 Whatareimmutableandmutabletypes?Listimmutableandmutabletypesof python. 2

23 IfgivenA=2,B=1,C=3,Whatwillbetheoutputoffollowingexpressions: 2
(i) print((A>B)and(B>C)or(C>A))
(ii) print(A**B**C)
24 Writethemostappropriatelistmethodtoperformthefollowingtasks. 2
(I)A)Todeleteagivenelementfrom thelistL1.
OR
B)Tosorttheelementsof listL1inascendingorder.
(II)A)ToaddanelementinthebeginningofthelistL1.
OR
B)ToaddelementsofalistL2intheendofa listL1.
25 Whatpossibleoutputs(s)areexpectedtobedisplayedonscreenatthe timeof execution of 2
the program from the following code? Also specify the maximum values that can be
assigned to each of the variables FROM and TO.
import random
AR=[20,30,40,50,60,70]
FROM=random.randint(1,3)
TO=random.randint(2,4)
forKinrange(FROM,TO):
print (AR[K],end=”#“)
(i)10#40#70#(ii)30#40#50# (iii)50#60#70# (iv)40#50#70#
26 RewritethefollowingcodeinPythonafterremovingallsyntaxerror(s).Underline each 2
correction done in the code.
p=30
forcinrange(0,p) If
c%4==0:
print (c*4)
Elseifc%5==0:
print (c+3)
Page3of7
else
print(c+10)
27 (i)(A)Whatconstraintshouldbeappliedonatablecolumnsothatduplicate values are not 2
allowed in that column, but NULL is allowed.
OR

Page4of7
(B)WhatconstraintshouldbeappliedonatablecolumnsothatNULLisnot allowed in
that column, but duplicate values are allowed.
(ii)
(A)WriteanSQLcommandtoremovethePrimaryKeyconstraintfromatable, named
MOBILE. M_ID is the primary key of the table.
OR
B)WriteanSQLcommandtomakethecolumnM_IDthePrimaryKeyofan already
existing table, named MOBILE.
28 (A) HowisiteasiertodiagnosefaultinStartopologythaninBustopology ? 2
OR
(B) NirmalaisabitconfusedbetweenthetermsWebserverandWebbrowsers. Help her
in understanding both the terms with the help of suitable example.

Q Section-C(3 x3 =9Marks) Mark


29 (A)WriteaPythonfunctionthat countthelinesstartwiththeword“the” inafile “xyz.txt” 3
and display it at the end.
OR
B)WriteaPythonfunctionthatCounttotalnumberofvowelsinafile“abc.txt”.
30 (A) Madhurihasalistcontaining10integers.Youneedtohelphimcreatea program 3
withseparateuserdefinedfunctionstoperformthefollowingoperationsbasedon this list.
● Traversethecontentof thelistandpushtheODDnumbersintoa stack.
● Popanddisplaythecontentofthestack. For
Example:
IfthesampleContentof thelistisasfollows:
N=[12,13,34,56,21,79,98,22,35,38]
SampleOutputofthecodeshouldbe:
13,21,89,35
OR
(B) Sarojhavealistof10 numbers . You need tohelphimcreate aprogram with
separateuserdefinedfunctionstoperformthefollowingoperationsbasedonthis list.
● Traversethecontentofthelistandpushthenumbersintoastackwhichare divisible
by 5.
● Popanddisplaythecontentofthestack. For
Example:
IfthesampleContentofthelistisasfollows:
N=[2,5,10,13,20,23,45,56,60,78]
SampleOutputofthecodeshouldbe: 5,10,20,45,60

Page5of7
31 (A)PredicttheoutputofthePythoncodegivenbelow: def 3
func(n1 = 1, n2= 2):
n1=n1*n2
n2= n2 + 2
print(n1,n2)
func( )
func(2,3)

OR
(B)PredicttheoutputofthePythoncodegivenbelow: T=
[“20”, “50”, “30”, “40”]
Counter=3
Total= 0
for I in [7,5,4,6]:
newT=T[Counter]
Total= float (newT) +
I print(Total)
Counter=Counter-1

Q Section-D(4x4=16Marks) Mark
32 WriteSQLqueriesfor(i)to(iv),whicharebasedonthetable:ACTIVITY given 4
below:
Table:ACTIVITY
ACode ActivityName ParticipantsNum PrizeMoney ScheduleDate
1001 Relay100x4 16 10000 23-Jan-2004
1002 Highjump 10 12000 12-Dec-2003
1003 ShotPut 12 8000 14-Feb-2004
1005 LongJump 12 9000 01-Jan-2004
1008 DiscussThrow 10 15000 19-Mar-2004
(i) TodisplaythenameofallactivitieswiththeirAcodesindescendingorder.
(ii) TodisplaysumofPrizeMoneyforeachoftheNumberofparticipants groupings (as
shown in column ParticipantsNum(10,12,16).
(iii) TodisplaytheScheduleDateandParticipantsNumberfortheactivity
Relay100x4.
(iv) ToincreasePrizeMoneyby500forHighjumpactivity
OR
WriteoutputforSQLqueries(i)to(iii)andqueryfor(iv),whicharebasedonthe table:
ACTIVITY:
(i) selectcount(distinctParticipantsNum)from ACTIVITY;
(ii) selectmax(ScheduleDate),min(ScheduleDate)fromACTIVITY;
(iii) selectsum(PrizeMoney)fromACTIVITY;
(iv)Writeaqueryto deletetherecordof Acode 1003.

Page6of7
33 Abhishek is making a software on “Countries & their Capitals” in which various 4
recordsaretobestored/retrievedinCAPITAL.CSVdatafile.Itconsistsofsome records.
As a programmer, you have to help him to successfully execute the program.

(A) WriteafunctioninPythonnamedAddNewRec(Country,Capital)toappend
following records in the file “CAPITAL.CSV”.
[“FRANCE”,”PARIS”]
[“SRILANKA”,”COLOMBO”]
(B) WriteafunctioninPythonnamedShowRec() thatwillshowallthecontentsof
CAPITAL.CSV
34 WriteSQLcommandsforthequeries(i)to(iii)andoutputfor(iv)&(v)based on a table 4
COMPANY and CUSTOMER .

COMPANY
CID CNAME CITY PRODUCTNAME
111 SONY DELHI TV
222 NOKIA MUMBAI MOBILE
333 ONIDA DELHI TV
444 SONY MUMBAI MOBILE
555 BLACKBERRY MADRAS MOBILE
666 DELL DELHI LAPTOP

CUSTOMER
CUSTID NAME PRICE QTY CID
101 RohanSharma 70000 20 222
102 DeepakKumar 50000 10 666
103 MohanKumar 30000 5 111
104 Sahil Bansal 35000 3 333
105 NehaSoni 25000 7 444
106 SonalAggarwal 20000 5 333
107 ArjunSingh 50000 15 666
(i) Todisplaythosecompanyname alongwithprice whicharehavingpriceless than
30000.
(ii) Todisplaythename andpriceofthecompanieswhosepriceisbetween20000 to
35000.
(iii) Toincreasethepriceby1000forthosecustomerwhosenamestartswith‘S’
(iv) Todisplaythoseproductname,cityandpricewhicharehavingproductname as
MOBILE.
35 KabirwantstowriteaprograminPythontoinsertthefollowing recordinthetable named 4
Student in MYSQL database, SCHOOL:
- rno(Rollnumber)– integer
- name(Name)–string

Page7of7
- DOB(DateofBirth)–Date
- Fee –float
NotethefollowingtoestablishconnectivitybetweenPythonandMySQL:
- Username–root
- Password–tiger
- Host–localhost
Thevaluesoffieldsrno,name,DOBandfeehastobeacceptedfromtheuser. Help
Kabir to write the program in Python.

Q Section-E(2x 5=10Marks) Mark


36 Amit is a manager working in a recruitment agency. He needs to manage the 5
recordsofvariouscandidates.Forthis,hewantsthefollowinginformationofeach
candidate to be stored: -
Candidate_ID – integer
Candidate_Name–string
Designation – string
Experience – float

You,asaprogrammerof thecompany,havebeenassignedtodothisjobforAmit.
(i) Writeafunctiontoinputthedataofacandidateandappenditinabinaryfile.
(ii) Writeafunctiontoupdatethedataofcandidates whoseexperience ismore than 12
years and change their designation to "Sr. Manager".
(iii) Writeafunctiontoreadthedatafrom thebinaryfileanddisplaythedataofall those
candidates who are not "Sr. Manager".
37 PVSComputersdecidedtoopenanewofficeat Ernakulum,theofficeconsistof Five 5
Buildings and each contains number of computers. The details are shown below.

Distancebetweenthebuildings

Building 1 and 2 20 Meters Building


Noofcomputers Building 2 and 3 50
Meters 1 40
2 45
Building3and4 120Meters 3 110
Building3and5 70Meters 4 70
5 60
Building1and5 65Meters
Building2and5 50Meters

The Company has now decided to connect network in buildings.


Page8of7
(i)Suggestthemostsuitableplace(i.e.building)tohousetheserverofthis
organization. Also give a reason to justify your suggested location.
(ii) WherewouldyouplaceHub/Switch?Answerwithjustification.
(iii) Suggestacablelayoutofconnectionbetweenthebuildings(Topology).
(iv) DoyouthinkanywhereRepeatersrequiredinthecampus?Why

Page9of7
KendriyaVidyalayaSangathan,JaipurRegion Pre-
Board Examination: 2024-25
MarkingschemeSetNo:1
Class:XII Subject:ComputerScience(083)
MaximumMarks:70 Period:3Hours
Instructions:
● Thisquestionpapercontains37questions.
● Allquestionsarecompulsory.However,internalchoiceshavebeenprovidedinsome
questions. Attempt only one of the choices in such questions
● Thepaperisdividedinto 5Sections-A,B,C,DandE.
● SectionAconsistsof21questions(1to21).Eachquestioncarries1 Mark.
● SectionBconsistsof7questions(22to28).Eachquestioncarries2 Marks.
● SectionCconsistsof3questions(29to31).Eachquestioncarries3Marks.
● SectionDconsistsof4questions(32to35).Eachquestioncarries4 Marks.
● SectionEconsistsof2questions(36to37).Eachquestioncarries5 Marks.
● AllprogrammingquestionsaretobeansweredusingPythonLanguageonly.
● InthecaseofMCQ,thetextofthecorrectanswershouldalsobewritten.

Q. Section-A(21x1=21 Marks) Mark


Ans1 True 1
(1markforcorrectanswer)
Ans2 (c)KENDRI*VID*LA* 1
(1markforcorrectanswer)
Ans3 (b)False 1
(1markforcorrectanswer)
Ans4 (c)[“abc”,“pink”,“city”] 1
(1markforcorrectanswer)
Ans5 tyJvmya 1
(1markforcorrectanswer)
Ans6 (c)tp1= tp+tp 1
(1markforcorrectanswer)
Ans7 (b)print(my_dict['aman','sumit']) 1
(1 mark for correct answer)
Ans8 (a)pop() 1
(1markforcorrectanswer)
Ans9 (c)Roll No 1
(1markforcorrectanswer)
Ans10file.seek(0)(ORfile.seek(0,0)) (1 1
mark for correct answer)
Ans11True 1
(1markforcorrectanswer)
Ans12(a)20#50@20 1
(1markforcorrectanswer)
Ans13(c)UPDATE 1
(1markforcorrectanswer)
Ans14(b)SELECT*FROMItemORDERBYINameDESC; 1
(1markforcorrectanswer)
Ans15(a)For pattern 1
matching(1markforcorrecta
nswer)
Ans16 (c)ALLthevalues 1
(1markforcorrectanswer)
Ans17(c)Hypertexttransferprotocol 1
(1 mark for correct answer)
Ans18(c)Gateway 1
(1markforcorrectanswer)
Ans19MessageSwitchingtechnique 1
(1 mark for correct answer)
Q20andQ21areAssertion(A)andReason(R)basedquestions.Markthecorrect choice
as:
(a) BothAandRaretrueandRisthecorrectexplanationforA
(b) BothAandRaretrueandRisnotthecorrectexplanationforA
(c) AisTruebutRisFalse
(d) AisFalsebutRis True
Ans20(b) BothAandRaretrueandRisnotthecorrectexplanationfor A (1 mark 1
for correct answer)
Ans21(c) AisTruebutRisFalse (1
mark for correct answer)

Q Section-B(7x2=14Marks) Mark
Ans Immutabletypesarethosethatcanneverchangetheirvalueinplace.Theseare: integers, 2
22 float, string, tuple
Mutabletypesarethosewhosevaluescanbechangedinplace.Theseare:lists, dictionaries
(1markforeachcorrectdefinitionandexample)

Ans (i) True 2


23 (ii) 2
(1markforeachcorrect answer.)
Ans 2
24 (I) A) L1.remove(4)
OR
B) L1.sort()
(II) A)L1.insert()
OR
B) L1.extend(L2)
(1markforeachcorrect answer)
Ans (ii)30#40#50# 2
25 MaximumvalueassignedtoFROMis3
Maximum value assigned to TO is 4
(1markforeachcorrect answer)
(½x2 =1MarkforcorrectMaximum values)
Ans p=30 2
26 forc in range(0,p):
ifc%4==0:
print(c*4)
elif c%5==0:
print(c+3)
else:
print(c+10)
(½markeachforcorrecting4mistakes)
Ans (I)A)UNIQUE 2
27 OR
B)NOTNULL
(1markforcorrectanswer)

(II)A)ALTERTABLEMOBILEDROPPRIMARYKEY;
OR
B)ALTERTABLEMOBILEADDPRIMARYKEY(M_ID);
(1markforcorrectanswer)
28 Ans:FaultdiagnosisiseasierinStartopologyasifthereisanyprobleminanode will affect 2
the particular node only. While in bus topology, if problem exists in common
medium it will affect the entire nodes.
OR
Web Server Web browser
A web server is a computer or a group Awebbrowserisanapplicationused of
computers that hosts or stores to access and view websites.
contentof website. Commonwebbrowsers include
It processes and delivers web pages MicrosoftInternetExplores,Google
of the websites to the users. Chrome etc.
Themainjobofawebserveristo display the
website content
(2markforcorrectanswer)

Q Section-C(3x3 =9Marks) Mark


29 (A) 3
Logic:-Weneedtosplitallthewordsof aeverylineandthencheckfirstwordof each line.
def count_the():
F=open(“abc.txt”,”r”)
L=F.readlines()
count=0
for x in L: # read all the lines one by one
L1=x.split()#Itwillsplitallthelinesintowords if
L1[0].lower() == “the” :
count=count+1
print(“total lines are :- “,count)
F.close()
(½ mark for correct function header)
(½markforcorrectlyopeningthefile)
(½markforcorrectlyreadingfrom thefile)
(½ mark for splitting the text into words/character)
(1markforcorrectlydisplayingthedesiredcounts)
OR
(B)
Readthefilecharacterbycharacter def
count_vowels():
F=open(“abc.txt”,“r”
) S=f.read()
Count=0
forxinS:
ifx.lower()in“aeiou”:
count=count+1
print(“totalnumberofvowelsare:-“,count)
F.close()

(½ mark for correct function header)


(½markforcorrectlyopeningthefile)
(½markforcorrectlyreadingfromthefile) (½
mark for checking vowels)
(1markforcorrectlydisplayingthedesiredcounts)
30 N=[12,13,34,56,21,79,98,22,35,38] def 3
PUSH(S,N):
S.append(N)def
POP(S):
if S!=[ ]:
returnS.pop()
else:
returnNone
ST=[ ]
fork in N:
ifk%2!=0:
PUSH(ST,k)
whileTrue:
ifST!=[]:
print(POP(ST),end="")
else:
break
(2x1markforcorrectfunctionbody;1markforfunction calling)
OR
(B)N=[2,5,10,13,20,23,45,56,60,78]
def PUSH(S,N):
S.append(N)de
f POP(S):
ifS!=[]:
returnS.pop()
else:
returnNone
ST=[]
fork in N:
ifk%5==0:
PUSH(ST,k)
whileTrue:
ifST!=[]:
print(POP(ST),end="")
else:
break
(2x1markforcorrectfunctionbody;1markforfunction calling)
31 24 3
65
OR
47.0
35.0
54.0
26.0
(3Markforcorrectoutput,1markforpartialcorrect)

Q Section-D(4x4=16Marks) Mark
32 i) SelectActivityName,AcodefromACTIVITYorderbyAcodedesc; 4
ii) Selectsum(PrizeMoney)fromACTIVITYgroupbyParticipantsNum;
iii) SelectScheduleDate,ParticipantsNumfromACTIVITYwhere
ActivityName= ‘Relay 100 x4’;
iv) UpdateACTIVITYsetPrizeMoney=PrizeMoney+500where
ActivityName = “High jump”;
(1markforeachcorrect Query.)
OR
(i)
Count(distinctParticipantsNum)

3
(ii)

(iii)
Sum(PrizeMoney)

54000
(iv)deletefromACTIVITYwhereAcode=1003; (1
mark for each correct answer.)
Ans Ans:(a) 4
33 import csv
defAddNewRec(Country,Capital):
f=open("CAPITAL.CSV",'a')
fwriter=csv.writer(f,lineterminator="\
n")
fwriter.writerow([Country,Capital])
f.close()
(b)
def ShowRec():
withopen("CAPITAL.CSV","r")asNF:
NewReader=csv.reader(NF)
forrecinNewReader:
print(rec[0],rec[1])

AddNewRec(“FRANCE”,”PARIS”)
AddNewRec(“SRILANKA”,”COLOMBO”)
ShowRec()
Ans SQLTwotablebasedquestion 4
34 (i) SELECTCNAME,PRICEFROMCOMPANY,CUSTOMERWHERE
COMPANY.CID = CUSTOMER.CID AND PRICE < 30000;
(ii) SELECT CNAME, PRICE FROM COMPANY, CUSTOMER WHERE
COMPANY.CID=CUSTOMER.CIDANDPRICEBETWEEN20000AND35000;
(iii) UPDATECUSTOMERSETPRICE=PRICE+1000WHERENAMELIKE“S%”;
(iv) SELECT PRODUCTNAME,CITY, PRICE FROM
COMPANY,CUSTOMER
WHERECOMPANY.CID=CUSTOMER.CIDANDPRODUCTNAME=”MOBI
LE”;
(1markforeachcorrect query.)
Ans importmysql.connectoras mysql 4
35 con1=mysql.connect(host=“localhost”,user=“root”,password=“tiger”, database =
“sample”)
mycursor=con1.cursor()
rno=int(input(“EnterRollNumber:“))
name =Max(ScheduleDate)
input(“Enter the name : “) Min(ScheduleDate)
DOB = input(“Enter date of Birth : “)
2004-03-19
fee = float(input(“Enter Fee : “ 2003-12-12
query=“INSERTintostudentvalues({},‘{}’, ‘{}’,{})”.format(rno,name,DOB,fee)
mycursor.execute(query)
con1.commit()
print(“Dataaddedsuccessfully”) con1.close(
)
(½markforcorrectlyimportingtheconnectorobject)
(½markforcorrectlycreatingtheconnectionobject) (½
mark for correctly creating the cursor object)
(½markforcorrectlyinputtingthedata) (1
mark for correct creation of query)
(½markforcorrectlyexecutingthefirstquerywithcommit (½
mark for correctly displaying the data)

Q Section-E(2x 5=10Marks) Mark


Ans (I) import pickle 5
36 definput_candidates():
candidates = [ ]
n=int(input("Enterthenumberofcandidatesyouwanttoadd:")) for i in
range(n):
candidate_id = int(input("Enter Candidate ID: "))
candidate_name=input("EnterCandidateName:")
designation = input("Enter Designation: ")
experience = float(input("Enter Experience (in years): "))
candidates.append([candidate_id,candidate_name,designation,
experience])
return candidates
candidates_list=input_candidates()

def append_candidate_data(candidates):
withopen('candidates.bin','ab')asfile:
for candidate in candidates:
pickle.dump(candidate,file)
print("Candidatedataappendedsuccessfully.")
append_candidate_data(candidates_list)

(II) importpickle
defupdate_senior_manager():
updated_candidates = [ ]
try:
withopen('candidates.bin','rb')asfile:
while True:
try:
candidate=pickle.load(file)
ifcandidate[3]>10:#Ifexperience>10years candidate[2] =
'Senior Manager'
updated_candidates.append(candidate)
except EOFError:
break#Endoffilereached
except FileNotFoundError:
print("Nocandidatedatafound.Pleaseaddcandidatesfirst.") return
with open('candidates.bin', 'wb') as file:
forcandidateinupdated_candidates:
pickle.dump(candidate,file)
print("CandidatesupdatedtoSeniorManagerwhereapplicable.")
update_senior_manager()

(III)
importpickle
defdisplay_non_senior_managers():
try:
withopen('candidates.bin','rb')asfile:
while True:
try:
candidate=pickle.load(file)
ifcandidate[2]!='SeniorManager':#CheckifnotSeniorManager
print(f"Candidate ID: {candidate[0]}")
print(f"CandidateName:{candidate[1]}")
print(f"Designation: {candidate[2]}")
print(f"Experience: {candidate[3]}")
print(" ")
exceptEOFError:
break#Endoffilereached
except FileNotFoundError:
print("Nocandidatedatafound.Pleaseaddcandidatesfirst.")
display_non_senior_managers()

(1/2markofimportpickle) (1/2
mark for input)
(1/2markforopeningfileinappendmodeand1/2markforusingdump) (1/2 mark
for opening file in read mode and 1/2 mark for using load)
(1markforcheckingtheconditionandupdatingthevalue)
(1markforcheckingtheconditionanddisplayingdatacorrectly) (1
mark for try and except block)
37 Networkingbasedquestion 5
(i) ServershouldbeinstalledinBuilding3,Asmaximumcomputeristhere
(ii) Hub/Switchinstalledineachandeverybuildingtoconnectcomputersineach
building.
(iii) Bus/Startopology
(iv) Norepeaterisrequiredasdistancebetweenbuildingislessthan100meter.
(v) Voip
OR
LAN(LocalAreaNetwork)

(1x5=5markforeachcorrect answer)
MARKINGSCHEMEOF1stPREBOARD(KVSROKOLKATA)
2024-25 ( COMPUTER SCIENCE)
Timeallowed:3Hours MaximumMarks: 70

General Instructions:
● Thisquestionpapercontains37questions.
● Allquestionsarecompulsory.However,internalchoiceshavebeenprovidedinsome questions.
Attempt only one of the choices in such questions
● Thepaperisdividedinto5Sections-A,B,C,DandE.
● SectionAconsistsof21questions(1to21).Eachquestioncarries1Mark.
● SectionBconsistsof7questions(22to28).Eachquestioncarries2Marks.
● SectionCconsistsof3questions(29to31).Eachquestioncarries3Marks.
● SectionDconsistsof4questions(32to35).Eachquestioncarries4Marks.
● SectionEconsistsof2questions(36to37).Eachquestioncarries5Marks.
● AllprogrammingquestionsaretobeansweredusingPythonLanguageonly.
● IncaseofMCQ,textofthecorrectanswershouldalsobewritten(Nomarksshouldbe provided
if student does not write the correct choice )

QNo. Section-A(21x1=21Marks) Marks

1. StateTrueorFalse:
(1)
ThePythonstatementprint(‘Alpha’+1)isexampleofTypeErrorError

Ans:True
2. Whatidtheoutputoffollowingcodesnippet?

country= "GlobalNetwork" (1)


result="-".join(country.split("o")).upper()
print(result)
(A)GL-BALNETW-RK
(B)GL-BA-LNET-W-RK
(C)GL-BA-LNET-W-RK
(D)GL-BA-LNETWORK

Ans:A)GL-BALNETW-RK
3. Identifytheoutputofthefollowingcodesnippet:

text="The_quick_brown_fox"
index = text.find("quick")
result=text[:index].replace("_","")+text[index:].upper() (1)
print(result)

(A) Thequick_brown_fox
(B) TheQUICK_BROWN_FOX
Page:1/21
(C) TheQUICKBROWNFOX
(D) TheQUICKBROWN_FOX

Ans:(B)TheQUICK_BROWN_FOX

4. WhatwillbetheoutputofthefollowingPython expression? x =
5
y= 10
(1)
result=(x**2+y)//x*y-x
print(result)

(A) 0
(B) -5
(C) 65
(D) 265

Ans: (C)65
5. Whatwillbetheoutputofthefollowingcodesnippet?
(1)
text="PythonProgramming"
print(text[1 : :3])

(A) Phoai
(B) yoPgmn
(C) yhnPormig
(D) Ptorgamn
Ans:(B)
6. Whatwillbetheoutputofthefollowingcode?
tuple1 = (1, 2, 3)
tuple2=tuple1+(4,) tuple1 +=
(5,) print(tuple1, tuple2)
(1)
(A) (1,2,3)(1,2,3,4)
(B) (1,2,3,5)(1,2, 3)
(C) (1,2,3,5)(1,2,3,4)
(D) Error

Ans:C)

7. Dictionarymy_dictasdefinedbelow,identifytypeoferrorraisedby statement
my_dict['grape']?
my_dict={'apple':10,'banana':20,'orange':30}
ValueError (1)
(B) TypeError
(C) KeyError
(D) ValueError
Page:2/21
Ans:(C) KeyError

8. Whatdoesthelist.pop(x)methoddoinPython?

A. Removesthefirstelementfromthelist. (1)
B. Removestheelementatindexxfromthelistandreturnsit.
C. Addsanewelementat indexxinthe list.
D. ReplacestheelementatindexxwithNone.

Ans:B.Removestheelementatindexxfromthelistandreturns it.
In a relational database table with one primary key and three unique
9.
constraintsdefinedondifferentcolumns(notprimary),howmanycandidate keys
can be derived from this configuration?
(1)
(A)1
(B)3
(C)4
(D)2

Ans:C)4
10. Fillintheblankstocompletethefollowingcodesnippetchoosingthe correct
option:

withopen("sample.txt","w+")asfile:
file.write("Hello, World!")# Write a string to the file (1)
position_after_write = file. #Getthepositionafterwriting
file.seek(0)# Move the pointer to the beginning
content=file.read(5)#Readthefirst5characters print(content)

(A) tell
(B) seek
(C)read
(D)write

Ans:(A)tell

11. StatewhetherthefollowingstatementisTrueorFalse:
In Python, if an exception is raised inside a try block and not handled,
theprogramwillterminatewithoutexecutinganyremainingcodeinthe finally (1)
block.

Ans:False

Page:3/21
12. Whatwillbetheoutputofthefollowingcode? x =
4
def reset():
globalx
x=2
print(x,end='&'
) def update(): (1)
x+=3
print(x,end='@')

update()
x=6
reset()
print(x,end='$')

(A) 7@2&6$
(B) 7@6&6$
(C) 7@2&2$
(D) Error
Ans:(D)Error:Unboundlocalvariablexinfunction update()
WhichSQLcommandcanmodifythestructureofanexistingtable,suchas adding or
13. (1)
removing columns?

(A) ALTERTABLE
(B) UPDATETABLE
(C) MODIFYTABLE
(D) CHANGETABLE

Ans.(A)ALTERTABLE
14. Whatwillbetheoutputofthe query?
SELECT*FROMordersWHEREorder_dateLIKE'2024- 10-%';
(A) DetailsofallordersplacedinOctober2024
(B) DetailsofallordersplacedonOctober10th,2024 (1)
(C) Detailsofallordersplacedintheyear2024
(D) Detailsofallordersplacedonanydayin2024

Ans:(A)DetailsofallordersplacedinOctober2024

15. WhichofthefollowingstatementsabouttheCHARandVARCHAR
datatypes in SQL is false?
(A) CHARisafixed-lengthdatatype,anditpadsextraspacestomatchthe
specified length. (1)
(B) VARCHARisavariable-lengthdatatypeanddoesnotpadextraspaces.
(C) ThemaximumlengthofaVARCHARcolumnisalwayslessthanthatof a
CHAR column.
(D) CHARisgenerallyusedforstoringdataofaknown,fixedlength.
Page:4/21
Ans: (C)

16. Whichofthefollowingaggregatefunctionscanbeemployedtodetermine the


number of unique entries in a specific column, effectively ignoring
duplicates? (1)
(A) SUM()
(B) COUNT()
(C) AVG()
(D) COUNT(DISTINCTcolumn_name)
Ans:(D)COUNT(DISTINCTcolumn_name)

17. Whichprotocolisusedtosende-mailoverinternet?
(A)FTP
(B) TCP
(C) SMTP
(D) SNMP (1)
Ans.(C)SMTP
18. Whichdeviceisprimarilyusedtoamplifyandregeneratesignalsina network,
allowing data to travel longer distances?
(A) Switch
(B) Router (1)
(C) Repeater
(D) Bridge
Ans: (C) Repeater
19. Which communication technique establishes a dedicated communication
path between two devices for the entire duration of a transmission, ensuring (1)
a continuous and consistent connection?

Ans: CircuitSwitching
Q20andQ21areAssertion(A)andReason(R)basedquestions.Mark the
correct choice as:
(A) Both AandRare trueandRisthecorrectexplanationfor A
(B)BothAandRaretrueandRisnotthecorrectexplanation for A
(C) AisTruebutRisFalse
(D) AisFalse butRisTrue

Assertion(A):Pythonfunctionscanacceptpositional,keyword,anddefault
20.
parameters.

Reasoning(R):Defaultparametersallowfunctionargumentstobeassigned a (1)
default value if no argument is provided during the function call.

Ans : (B) Both Aand R are true and R is not the correct explanantion
for A

Page:5/21
Assertion(A):AGROUPBYclauseinSQLcanbeusedwithoutany aggregate
21.
functions.
Reasoning(R):TheGROUPBYclauseisusedtogrouprowsthathavethe (1)
samevaluesinspecifiedcolumnsandmustalwaysbepaired with
aggregate functions.

Ans:(C )Ais True ,butR is False

QNo Section-B(7x2=14Marks) Marks


ConsiderthefollowingPythoncodesnippet:
22.
a= [1,2,3]
b=a (2)
a.append(4)
c=(5,6,7)
d = c + (8,)
a. Explainthemutabilityof aandcinthecontextof thiscode.
b. Whatwillbethevaluesofbanddafterthecodeisexecuted?

Ans:a)aisamutableobject(alist),meaningitscontentscanbe changed
after it is created. This is demonstrated bythe append() method
that adds an element to the list.
c is an immutable object (a tuple). Once created, its contents cannot
bechanged.Theoperationc+(8,)doesnotmodifycbutcreatesanew tuple.

b)The valueofbwillbe[1,2,3,4],asbreferencesthesamelistasa, which was


modified by appending 4.
Thevalueofdwillbe(5,6,7,8),astheexpressionc+(8,)createsa new tuple
combining c and (8,).

(1 marks+ 1Marks)

Giveexamplesforeachofthefollowingtypesof operatorsinPython:
23.
(2)
(I)AssignmentOperators

(II)Identity Operators

Ans:

(I)Assignment Operators: ( 1 MarksforAny oneofthem)

1. Example1:=(SimpleAssignment)Usage:x=5(assignsthe
value 5to x)
2. Example2:+=(AddandAssign) :Usage:x+=3(equivalenttox
=x+3)

(II)IdentityOperators:(1Marks foranyoneof them)

1. Example1: is,Usage: xisy(checksif xandyrefertothe same


Page:6/21
object)
2. Example2: isnot:Usage: xisnoty(checksif xandydo not
refer to the same object)

IfL1=[10,20,30,40,20,10,...] andL2=[5,15,25,...], then:


24.
(Answerusingbuiltinfunctionsonly)

(I) A)Writeastatementtocounttheoccurrencesof20inL1. OR (2)


B)WriteastatementtofindtheminimumvalueinL1.

(II) A)WriteastatementtoextendL1withallelementsfromL2.
OR
B)Writeastatementtogetanewlistthatcontainstheuniqueelements from L1.

Ans:I( A):count_20=L1.count(20)
(B): min_value=min(L1)

II(A): L1.extend(L2)
(B):unique_elements=list(set(L1))

(1marksforeachcorrectanswer,nomarksifdidnotused any built in


function )

25. Identifythecorrectoutput(s)ofthefollowingcode.Alsowritetheminimum and


the maximum possible values of the variable b.
importrandom
text="Adventure"
b=random.randint(1,5) for i in
range(0, b):
print(text[i],end='*') (2)

(A)A* (B)A*D*
(C)A*d*v* (D)A*d*v*e*n*t*u*
Ans: Minimumpossiblevalueof b:1( 1/2+1/2marks)
 Maximumpossiblevalueofb:5

PossibleOutputs: (A)and(C ) (1/2+1/2 marks)

Page:7/21
26. The code provided below is intended to reverse the order of elements in a
givenlist.However,therearesyntaxandlogicalerrorsinthecode.Rewrite it after
removing all errors. Underline all the corrections made.

defreverse_list(lst)
if not lst:
return (2)
lstreversed_lst=lst[::-
1] return reversed_lst
print("Reversedlist:"reverse_list[1,2,3,4])

Ans: Corrections: (1/2x 4 =2)


iAddedacolon(:)afterthe functiondefinition.
ii. Indentedtheifstatementandthereturnstatementforproper
structure.
iii. Put()whilecallingthefunctionreverse_list()
iv. Addedacomma (,)intheprintstatementforcorrectsyntax.
27. (I)
A) Whatconstraintshouldbeappliedtoatablecolumntoensurethatall values
in that column must be unique and not NULL?
OR
B) Whatconstraintshouldbeappliedtoatablecolumntoensurethatitcan have
multiple NULL values but cannot have any duplicate non-NULL values? (2)
(II)
A) Write an SQL command to drop the unique constraint named
unique_emailfromacolumnnamedemailinatablecalledUsers.
OR
B) WriteanSQLcommandtoaddauniqueconstrainttotheemailcolumn of an
existing table named Users, ensuring that all email addresses are unique.

Ans:(I)(A):UsetheUNIQUEconstraintalongwiththeNOTNULLOR
PRIMARY KEY constraint.
OR
(B):UsetheUNIQUEconstraintalone,allowingformultipleNULL
values.
Example:column_nameINTUNIQUENULL

(II)
(A):ALTERTABLEUsersDROPC
ONSTRAINTunique_email; OR
(B):ALTERTABLEUsersADDCONSTRAINTunique_emailUNIQUE
(email);

(1markeachforcorrectpartforeachquestionsanycorrectexample as ananswer
is acceptable )

Page:8/21
28. A) Explainoneadvantageandonedisadvantageofmeshtopologyin
computer networks.
OR (2)
B) ExpandthetermDNS.WhatroledoesDNSplayinthefunctioningofthe
Internet?

Ans:
(A) :AdvantageofMeshTopology:Highredundancy;ifoneconnection fails,
data can still be transmitted through other nodes.
DisadvantageofMeshTopology:Complexityandhighcost;requires more
cabling and configuration compared to simpler topologies.
OR

(B) : ·DNS stands for Domain Name System. It translates human-


readabledomainnames(likewww.example.com)intoIPaddressesthat
computers use to identify each other on the network.

(for partA 1/2 + 1/2)


(forpartB 1/2 for correctabbreviationand1/2forcorrect use)

QNo. Section-C(3x3=9Marks) Marks

29. A) Write a Python function that extracts and displays all the words present in a text
file “Vocab.txt” that begins with a vowel..
OR (3)
B) Write a Python function that extracts and displays all the words
containing a hyphen ("-") from a text file "HyphenatedWords.txt", which
has a three letter word before hypen and four letter word after hypen.
For example : “for-them” is such a word.
Ans :A)
defdisplay_words_starting_with_vowel():
vowels = 'AEIOUaeiou'
withopen('Vocab.txt','r')asfile:
words=file.read().split()
#Loopthroughthewordsandcheckifthefirstletterisavowel for word
in words:
ifword[0]invowels:
print(word)

B)
def display_specific_hyphenated_words():
withopen('HyphenatedWords.txt','r')asfile:
words=file.read().split()
#Loopthroughthewordsandcheckiftheymatchthepattern for word
in words:
#Checkifthewordishyphenatedandmatchestheformat"XXX-
XXXX"
Page:9/21
iflen(parts)==2andlen(parts[0])==3andlen(parts[1])==4:
print(word)

1/2 mark forfileopening+1/2 mark forcorrectloop+1/2markfor


correctuseofsplit()+1markforcorrectcondition+1/2markfor output

(A) You have a stack named MovieStack that contains records of movies.
30.
Each movie record is represented as a list containing movie_title,
director_name,andrelease_year.Writethefollowinguser-definedfunctions in
Python to perform the specified operations on the stack MovieStack:

(I) push_movie(MovieStack, new_movie): This function takes the stack


MovieStackandanewmovierecordnew_movieasargumentsandpushes the new
movie record onto the stack.

(II) pop_movie(MovieStack):Thisfunctionpopsthetopmostmovierecord
from the stack and returns it. If the stack is empty, the function should
display "Stack is empty".

(III) peek_movie(MovieStack): This function displays the topmost movie (3)


recordfromthestackwithoutdeletingit.Ifthestackisempty,thefunction should
display "None".

OR

(B) Write the definition of a user-defined function push_odd(M) which


acceptsalistofintegersinaparameterMand pushesallthoseintegers which are
odd from the list M into a Stack named OddNumbers.

Writethefunctionpop_odd()topopthetopmostnumberfromthestackand return it.


If the stack is empty, the function should display "Stack is empty".

Writethefunctiondisp_odd()todisplayallelementsofthestackwithout deleting
them. If the stack is empty, the function should display "None".

For example:

IftheintegersinputintothelistNUMBERSare:[7,12,9,4, 15]

ThenthestackOddNumbersshouldstore:[7,9,15]

Ans:(A)
def push_movie(movie_stack, new_movie): #1mark

movie_stack.append(new_movie)
Page:10/
21
def pop_movie(movie_stack):

if not movie_stack: #1mark

return "Stack is empty"

return movie_stack.pop()

defpeek_movie(movie_stack):

if not movie_stack: #1mark

return "None"

returnmovie_stack[-1]
OR

(B)defpush_odd(M,odd_numbers):

for number in M: #1mark

if number % 2 != 0:

odd_numbers.append(number)

def pop_odd(odd_numbers):

if not odd_numbers: #1mark

return "Stack is empty"

returnodd_numbers.pop()

def disp_odd(odd_numbers):

if not odd_numbers: #1mark

return "None"

returnodd_numbers

Page:11/
21
31. Predicttheoutputofthefollowingcode:
data=[3,5,7,2]
result=""
fornumindata:
for i in range(num):
result+=str(i)+"*"
result=result[:-1] print(result)
OR
Predicttheoutputofthefollowingcode:
(3)
numbers = [10, 15, 20] for num
in numbers:
forjinrange(num//5):
print(j,"+",end="")
print()

Ans: 0*1*2*0*1*2*3*4*0*1*2*3*4*5*6*0*1
(1markforpredictingcorrectoutputsequenceof numbers + 1 mark
for predicting correct placement of * + 1 mark for removing last
*)

OR
0+1+
0+1+2+
0+1+2+3+
(1MARKForputtingoutputinthreelines+1markfor predicting correct
sequence of numbers in each line ( 1/2 for incorrect partially correct) + 1
mark for
correctplacementof+)
QNo. Section-D( 4x4=16Marks) Marks
32. ConsiderthetableORDERSasgivenbelow

O_Id C_Name Product Quantity Price


1001 Jitendra Laptop 1 12000
1002 Mustafa Smartphone 2 10000
1003 Dhwani Headphone 1 1500
1004 Alice Smartphone 1 9000
1005 David Tablet NULL 7000

Note:Thetablecontainsmanymorerecordsthanshown here. (4)


A) Writethefollowingqueries:
(I) TodisplaythetotalQuantityforeachProduct,excludingProductswith total
Quantity less than 5.

Page:12/
21
(II) TodisplaytheORDERStablesortedbytotalpriceindescendingorder.
(III) TodisplaythedistinctcustomernamesfromtheORDERS table.

(IV)Todisplaythesum ofthePriceofalltheordersforwhichthequantity is
NULL.
OR
B) Writethe output:
(I) SELECTC_Name,SUM(Quantity)ASTotal_QuantityFROMORDERS
GROUP BY C_Name;
(II) SELECT*FROMORDERSWHEREProductLIKE'%phone%';
(III) SELECTO_Id,C_Name,Product,Quantity,PriceFROMORDERS
WHERE Price BETWEEN 1500 AND 12000;
(IV) SELECTMAX(Price)FROMORDERS;

Ans:(A)(1MARKEACH)
(I) SELECTProduct,SUM(Quantity)ASTotal_Quantity
FROM ORDERS
GROUP BY Product
HAVINGSUM(Quantity)>=5;

(II) SELECTO_Id,C_Name,Product,Quantity,Pri
ce FROM ORDERS
ORDER BYPriceDESC;

(III)SELECTDISTINCTC_N
ame FROM ORDERS;

(IV) SELECTSUM(Price)ASTotal_Price_Null_Quan
tity FROM ORDERS
WHERE QuantityISNULL;

OR
(B)(1MARKEACH)
(I)
C_NameTotal_Quantity
Jitendra 1
Mustafa2
Dhwani1
Alice 1
David NULL

Page:13/
21
(II)
O_IdC_Name Product Quantity Price
1002MustafaSmartphone2 10000
1004Alice Smartphone1 9000
(III)

O_I C_Name Product Quantity Price


d
1001 Jitendra Laptop 1 12000
1002 Mustafa Smartphone 2 10000
1003 Dhwani Headphone 1 1500
1004 Alice Smartphone 1 9000
(IV)
MAX(Price)
12000

Page:14/
21
ACSVfile"HealthData.csv"containsthedataofahealthsurvey.Each record of the
33.
file contains the following data:

 Nameof a country
 LifeExpectancy(averagenumberofyearsapersonisexpectedto live)
 GDPpercapita(GrossDomesticProductperperson)
 Percentageofpopulationwithaccessto healthcare

Forexample,asamplerecordofthefilemaybe:['Wonderland',82.5,40000, 95].
(4)
WritethefollowingPythonfunctionstoperformthespecified operations on
this file:

(I)Readallthedatafromthefileinthe formofalistanddisplayallthose records for


which the life expectancy is greater than 75.

(II)Countthenumberof recordsinthefile.

Ans:(I)
importcsv
def read_health_data(filename):
records=[]
withopen(filename,mode='r')asfile:
reader = csv.reader(file)
next(reader)#Skiptheheaderrowifpresent for
row in reader:
country = row[0]
life_expectancy=float(row[1])
gdp_per_capita= float(row[2])
access_to_healthcare=float(row[3]) if
life_expectancy > 75 :
records.append([country,life_expectancy,gdp_per_capita,
access_to_healthcare])
returnrecords

Page:15/
21
(II)
defcount_records():
records=read_health_data(“HealthData.csv”) return
len(records)
Alex has been tasked with managing the Student Database for a High
34.
School.HeneedstoaccesssomeinformationfromtheSTUDENTSand
SUBJECTS tables for a performance evaluation. Help him extract the
following information by writing the desired SQL queries as mentioned
below.
Table:STUDENTS

S_ID FNam LName Enrollment_Date Mar


e ks
201 John Doe 15-09-2020 85
(4)
202 Jane Smith 10-05-2019 90
Johnso
203 Alex 22-11-2021 75
n
204 Emily Davis 30-01-2022 60
Micha
205 Brown 17-08-2018 95
el

Table: SUBJECTS

Sub_ID S_ID SubName Credits


301 201 Mathematics 3
302 202 Science 4
303 203 History 2
304 204 Literature 3
305 205 Physics 4
Computer 3
306 201 Science
WritethefollowingSQLqueries:
(I) Todisplaycompletedetails(fromboththetables)ofthosestudents whose
marks are greater than 70.
(II) Todisplaythedetailsof subjectswhosecreditsareintherangeof2to4 (both
values included).
(III) Toincreasethecreditsofallsubjectsby1whichhave"Science"intheir subject
names.
(IV) (A)Todisplaynames(FNameandLName)ofstudentsenrolledinthe
"Mathematics" subject.
(OR)
(B)TodisplaytheCartesianProductofthesetwotables.

Ans: (I )
SELECT*FROMSTUDENTSS
Page:16/
21
JOINSUBJECTSSubONS.S_ID=Sub.S_ID
WHERE S.Marks > 70;

Page:17/
21
(II)
SELECT*
FROMSUBJECTS
WHERECreditsBETWEEN2AND4;
(III)
UPDATESUBJECTS
SETCredits=Credits+1
WHERESubNameLIKE'%Science%';
(IV) A:
SELECTFName,LName
FROM STUDENTS S
JOINSUBJECTSSubONS.S_ID= Sub.S_ID
WHERESub.SubName='Mathematics'; OR
B:
SELECT*
FROMSTUDENTS,SUBJECTS;

35. Atable,namedELECTRONICS,inthePRODUCTDBdatabase,hasthe following


structure:

Field Type
productID int(11)
productNamevarchar(20)
price float
stockQty int(11)
(4)
WritethefollowingPythonfunctiontoperformthespecifiedoperation:

AddAndDisplay(): To input details of a product and store it in the table


ELECTRONICS.Thefunctionshouldthenretrieve anddisplayallrecords from
the ELECTRONICS table where the price is greater than 150.
AssumethefollowingforPython-Databaseconnectivity: Host:
localhost
User: root
Password:Electro123

Ans:
importmysql.connector def
AddAndDisplay():
#Connecttothedatabase
conn=mysql.connector.connect( host
='localhost',
user='root',
password='Electro123',
database='PRODUCTDB'
Page:18/
21
)
cursor=conn.cursor()
productID=int(input("EnterProductID:"))

Page:19/
21
productName=input("EnterProductName:") price
= float(input("Enter Price: "))
stockQty=int(input("EnterStockQuantity:"))
cursor.execute("INSERTINTOELECTRONICS
(productID, productName,
price,stockQty)VALUES(%s,
%s, %s, %s)", (productID,
productName,price,stockQty))
conn.commit()
cursor.execute("SELECT*FROMELECTRONICS
WHEREprice>150")
records = cursor.fetchall()
print("\nRecordswithpricegreaterthan150:") for
record in records:
print(record)
cursor.close() conn.close()|
(1Mark forDeclarationofcorrectConnection Object
+1 Mark forcorrectinput+1 marksfor correctly
usingexecute()method+1marksforshowing output using
loop )
Q.No. SECTIONE(2X5=10Marks) Marks
Raj is a supervisor at a software development company. He needs to
36.
managetherecordsofvariousemployees.Forthis,hewantsthefollowing
information of each employee to be stored:
Employee_ID – integer
Employee_Name–string
Position – string
Salary–float (5)
You,asaprogrammerofthecompany,havebeenassignedtodothisjobfor Raj.
(I) Writeafunctiontoinputthedataofanemployeeandappendittoabinary file.
(II) Writeafunctiontoupdatethedataofemployeeswhosesalaryisgreater than
50000 and change their position to "Team Lead".
(III) Writeafunctiontoreadthedatafrom thebinaryfileanddisplaythedata of all
those employees who are not "Team Lead".

Ans : (I)
importpickle
def add_employee(filename):
employee_id = int(input("Enter Employee ID: "))
employee_name=input("EnterEmployeeName:") position =
input("Enter Position: ")
salary=float(input("EnterSalary:"))
new_employee=(employee_id,employee_name,position,salary) with
open(filename, 'ab') as file:
pickle.dump(new_employee,file)

(1/2 markfor input+1 markfor correctuseof dump()to addnew emp


Page:20/
21
data)
(II)
defupdate_employee(filename): employees
= []
withopen(filename,'rb')asfile: try:
while True:
employees.append(pickle.load(file))
exceptEOFError:
pass
foriinrange(len(employees)): if
employees[i][3] > 50000:
employees[i]=(employees[i][0],employees[i][1],"TeamLead",
employees[i][3])
withopen(filename,'wb')asfile: for
employee in employees:
pickle.dump(employee,file)
(1markforcorrectuseofload()methodtoretrievedata+1/2markfor correct loop
+ 1/2 mark for correct condition within loop )

(III)
def display_non_team_leads(filename): print("\
nEmployeeswhoarenotTeamLeads:") with
open(filename, 'rb') as file:
try:
while True:
employee= pickle.load(file)
ifemployee[2]!="TeamLead":
print(f"ID:{employee[0]},Name:{employee[1]},Position:
{employee[2]},Salary:{employee[3]}")
except EOFError:
pass
(1markforcorrectuseofTryexceptblockand1/2markforcorrect use of while
loop )

Page:21/
21
Interstellar Logistics Ltd. is an international shipping company. They are
37.
planningtoestablishanewlogisticshubinChennai,withtheheadofficein
Bangalore. The Chennai hub will have four buildings - OPERATIONS,
WAREHOUSE, CUSTOMER_SUPPORT, and MAINTENANCE. As a
networkspecialist,yourtaskistoproposethebestnetworkingsolutionsto address
the challenges mentioned in points (I) to (V), considering the distances
between the various buildings and the given requirements.

Building-to-BuildingDistances(inmeters): (5)

From To Distance
OPERATIONS WAREHOUSE 40 m
OPERATIONS CUSTOMER_SUPPORT 90 m
OPERATIONS MAINTENANCE 50 m
WAREHOUSE CUSTOMER_SUPPORT 60 m
WAREHOUSE MAINTENANCE 45 m
CUSTOMER_SUPPORT MAINTENANCE 55 m

DistanceofBangaloreHeadOfficefromChennaiHub:1300km Number

of Computers in Each Building/Office:

Location Computers
OPERATIONS 40
WAREHOUSE 20
CUSTOMER_SUPPORT 25
MAINTENANCE 22
BANGALOREHEADOFFICE15

Page:22/
21
(I)SuggestthemostsuitablelocationfortheserverwithintheChennaihub. Justify
your decision.

(II)Recommendthehardwaredevicetoconnectallcomputerswithineach
building efficiently.

(III) DrawacablelayouttointerconnectthebuildingsattheChennaihub
efficiently.Whichtypeofcablewouldyourecommendforthefastestand most
reliable data transfer?

(IV)Isthereaneedforarepeaterintheproposedcablelayout?Justifyyour answer.

(V) A)Recommendthebestoptionforlivevideocommunicationbetween the


Operations Office in the Chennai hub and the Bangalore Head Office from the
following choices:

 a)Video Conferencing
 b) Email
 c)Telephony
 d)Instant Messaging
OR

(V)B)Whattypeofnetwork(PAN,LAN, MAN,orWAN)wouldbesetup
among the computers within the Chennai hub?

Ans :
(I) TheservershouldbeplacedintheOPERATIONSbuilding.
Justification:

 Ithasthelargestnumberofcomputers(40),makingitthemost central
location in terms of the network load.
 Thedistancestootherbuildingsarerelativelyshort,ensuring
efficient data transfer. (1 Mark)

(II) A switch should be used within each building to connect all


computers.Aswitchisidealforcreatingalocalareanetwork(LAN) and
ensures efficient communication between devices in a single building.
( 1 Mark)

(III) Themostefficientcablelayoutwouldinvolveconnectingthe
buildings as follows:

 OPERATIONStoWAREHOUSE (40 m)
 OPERATIONStoMAINTENANCE(50m)
 OPERATIONStoCUSTOMER_SUPPORT(90m)
 WAREHOUSEtoMAINTENANCE(45m)
 WAREHOUSEtoCUSTOMER_SUPPORT(60m)

Page:23/
21
CUSTOMER_SUPPORT

(90m)

OPERATION

/ | \

(40 m)(50m)(60 m)

/ | \

WAREHOUSEMAINTENAN

CE

CableRecommendation:Fiberopticcableisrecommendedforhigh- speed
data transfer and reliable communication over distances. It offers better
bandwidth and lower signal degradation over long distances than copper
cables.( 1/2 + 1/2 mark)

(III) There is no need for a repeater in this layout. The maximum distance
betweenanytwobuildingsis90meters,whichiswellwithinthe100-meter limit
for Ethernet cable or fiber optics before requiring a repeater.

( 1mark)

(IV) A) The best option for live communication between the Chennai
Operations Office and the Bangalore Head Office would be Video
Conferencing.Thisallowsreal-timeface-to-facemeetingsandvisual
communication across long distances, which is ideal for inter-office
collaboration.

OR

(V)B)ThenetworktypeintheChennaihubwouldbeaLAN(LocalArea
Network), as all computers are located within a confined geographical
area (the logistics hub) and are connected to each other for data
communication within the same campus.

Page:24/
21
(1markforanycorrectpart solution )

Page:25/
21
KENDRIYAVIDYALAYASANGATHAN,CHENNAIREGION
CLASS: XII SESSION: 2024-25
PREBOARD
COMPUTERSCIENCE(083)
Timeallowed:3Hours Maximum Marks: 70
GeneralInstructions:
● Thisquestionpaper contains37 questions.
● Allquestionsarecompulsory.However,internalchoiceshavebeenprovidedinsomequestions.
Attempt only one of the choices in such questions
● Thepaper is dividedinto 5 Sections-A, B, C,D and E.
● SectionAconsistsof21questions(1to21).Eachquestioncarries1Mark.
● SectionBconsistsof7questions(22 to28).Eachquestioncarries2 Marks.
● SectionCconsistsof3questions(29to31).Eachquestioncarries3Marks.
● SectionDconsistsof4questions(32to35).Eachquestioncarries4Marks.
● SectionEconsistsof2questions(36to37).Eachquestioncarries5Marks.
● Allprogrammingquestionsaretobe answeredusingPythonLanguage only.
● Incaseof MCQ,text ofthecorrect answershouldalsobe written.

QNo. Section-A(21 x1=21Marks) Marks


1 StateTrueorFalse 1
InPython,a dictionaryisan orderedcollection ofitems(key:value pairs).
2 Statethe output of thefollowing 1
L1=[1,2,3]
L2=L1 i) [1,3,7]
L1.append(7) ii) [2,3,7]
iii) [1,14,3,7]
L2.insert(2,14)
L1.remove(1) iv) [2,14,3,7]
print(L1)
3 Thefollowingexpressionwillevaluateto 1
print(2+(3%5)**1**2/5+2)
i) 5 ii)4.6 iii) 5.8 iv)4
4 Whatistheoutputoftheexpression? 1
food=’Chinese Continental’
print(food.split(‘C’))
i) ('','hinese','ontinental')
ii) ['','hinese','ontinental']
iii) ('hinese','ontinental')
iv) ['hinese', 'ontinental']
5 Whatwillbeoutputofthefollowingcodesnippet? 1
Msg=’Wings of Fire!’
print(Msg[-9::2])
6 Whatwillbetheoutputofthefollowing: 1
T1=(10)
print(T1*10)
i) 10 ii)100 iii)(10,10) iv(10,)
7 Iffarmisatasdefinedbelow,thenwhichofthefollowingwillcauseanexception? 1
farm={‘goat’:5,’sheep’:35,’hen’:10,’pig’:7}
i) print(str(farm))
ii) print(farm[‘sheep’,’hen’])
iii) print(farm.get(‘goat))
iv) farm[‘pig’]=17
8 Whatdoesthereplace(‘e’,’h’)methodofstringdoes? 1
i) Replacesthefirstoccurrenceof‘e’to ‘h’
ii) Replacesthefirstoccurrenceof‘h’to ‘e’
iii) Replacealloccurrencesof‘e’to‘h’
iv) Replacesalloccurrences of‘h’to‘e’
9 Ifatablehas1primarykeyand3candidatekey,howmanyalternatekeys willbein the 1
table.
i) 4 ii) 3 iii)2 iv)1
10 Writethe missingstatement to completethe followingcode 1
file=open("story.txt"
) t1 = file.read(10)
#Movethefilepointertothebeginningofthefile
t2= file.read(50)
print(t1+t2)
file.close()
11 Whichofthefollowingkeywordisusedtopassthecontroltotheexceptblockin 1
Exceptional handling?
i) pass ii) finally iii)raise iv)throw
12 Whatwillbetheoutputofthefollowingcode: 1
sal= 5000
definc_sal(per):
globalsal i) 5000%6000$
inc=sal * (per / 100) ii) 5500.0%6000$
sal+=inc iii) 5000.0$6000%
inc_sal(10) iv)
5500%5500$
print(sal,end='%')
sal=6000
print(sal,end='$')
13 Statethesql command used to addacolumn to anexisting table? 1
14 Whatwill betheoutput ofthefollowingquery? 1
Mysql>SELECT*FROMCUSTOMERWHERECODE LIKE ‘_A%’
A) Customerdetailswhosecode’smiddleletterisA
B) Customersnamewhosecode’smiddleletterisA
C) Customersdetailswhosecode’ssecondletterisA
D) Customersnamewhosecode’ssecondletterisA
15 Sushma created a table named Person with name as char(20) and address as 1
varchar(40). She inserted a record with “Adithya Varman” and address as
“Vaanam
Illam,AnnaNagarIVStreet”.Statehowmuchbyteswouldhavebeensavedforthis
record.
i)(20,34) ii)(30,40) iii)(14,40) iv)14,34)
16 givesthenumber of values presentin an attributeof a relation. 1
a)count(distinct col) b)sum(col)c)count(col) d)sum(distinctcol)
17 Theprotocol used identifythe correspondingurl from ip address is 1
a)IP b)HTTP c)TCP d)FTP
18 Thedeviceusedto convertanalogsignal todigitalsignaland viceversais .. 1
a)Amplifier b)Router c)Modem d)Switch
19 In switchingtechnique, data isdivided into chunksof packets and 1
travelsthrough differentpaths and finallyreach thedestination.
Q20andQ21areAssertion(A)andReason(R)basedquestions.Markthecorrect
choice as:
(A) BothAand Raretrue andR isthecorrectexplanationfor A
(B) BothAand Raretrueand Risnot thecorrectexplanationfor A
(C) Ais Truebut R is False
(D) Ais False but Ris True
20 Assertion(A): Afunction canhavemultiplereturn statements 1
Reason(R) :Onlyonereturn getsexecuted Valuesarereturnedas atuple.
21 Assertion(A) :DROPis aDDLcommand 1
Reason(R):Itisusedtoremove allthecontentof adatabaseobject

QNo. Section-B( 7x2=14 Marks) Marks


22 Differentiatelistandtuplewithrespecttomutability.Givesuitableexampleto 2
illustratethesame.
23 Givetwo examplesof eachof the following 2
a)Assignmentoperators b)Logicaloperators
24 IfL1=[13,25,41,25,63,25,18,78]and L2=[58,56,25,74,56] 2
(i) A)WriteastatementtoremovefourthelementfromL1
Or
B)WritethestatementtofindmaximumelementinL2

(ii) (A)writeastatementtoinsertL2asthelastelementofL1
OR
(B)Writeastatementto insert15 assecondelementinL2
25 Identifythecorrectoutput(s)ofthefollowingcode.Alsowritetheminimumandthe 2
maximum possible values of the variable Lot
import random
word='Inspiration'
Lot=2*random.randint(2,4)
foriinrange(Lot,len(word),3):
print(word[i],end='$')

i) i$a$i$n$ ii)i$n$
iii) i$t$n$ iv)a$i$n$
26 IdentifyPrimaryKeyandCandidate Keypresentif anyinthebelowtablename 2
Colleges.Justify
Stren
Cid Name Location Year g th AffiUniv PhoneNumber
University
St.Xavier'
1 Mumbai 1869 10000 of 022-12345678
s College
Mumbai
Loyola University
2 College Chennai 1925 5000 of Madras 044-87654321
Hansraj Delhi
3 College New Delhi 1948 4000 University 011-23456789
Christ Christ
4 University Bengaluru 1969 8000 University 080-98765432
LadyShr
Delhi
5 i Ram New Delhi 1956 2500 011-34567890
University
College
27 (I) 2
(A)Whatconstraint/sshouldbeappliedtothecolumninatabletomakeitas alternate
key?
OR
(B)Whatconstraintshouldbeappliedonacolumnofatablesothatitbecomes
compulsory to insert the value
(II)
(A)WriteanSQLcommand toassignF_id asprimarykeyinthetablenamedflight
OR
(B)WriteanSQLcommandtoremovethecolumnremarksfromthetablename
customer.
28 Listoneadvantageanddisadvantageofstarandbustopology 2
OR
DefineDNSandstatethe useof Internet Protocol.

QNo. Section-C(3 x3 = 9 Marks) Marks


29 (A) Writeafunctionthatcountsnoofwordsbeginningwithacapitalletterfrom 3
the text file RatanJi.txt
Example:
IfyouwanttoWalkFast,
Walk Alone.
But-ifuwanttoWalkFar,
Walk Together
Output:
Noofwordsstartingwithcapital letter: 10

OR
(B) Writeafunctionthatdisplaysthelinenumberalongwithnoofwordsinit
from the file Quotes.txt
Example:
Nonecandestroyiron, butits ownrustcan!
Likewise,nonecandestroyaperson,buttheirownmindsetcan
The only way to win is not be afraid of losing.
Output:
Line Number Noofwords
Line 1: 9
Line2: 11
Line3: 11
30 (A) ThereisastacknamedUniformthatcontainsrecordsofuniformsEachrecord 3
is represented as a list containing uid, uame, ucolour, usize, uprice.
Writethefollowinguser-definedfunctionsinpythontoperformthespecified
operations on the stack Uniform :
(I) Push_Uniform(new_uniform):addsthenewuniformrecordontothestack
(II) Pop_Uniform():popsthetopmostrecordfromthestackandreturnsit.If
the stack is already empty, the function should display
“underflow”.
(III) Peep():Thisfunctiondiplaythetopmostelementofthestackwithout
deleting it.if the stack is empty,the function should display
‘None’.
OR
(a) Writethedefinitionofauserdefinedfunctionpush_words(N)whichaccept
listofwordsasparameterandpusheswordsstartingwithAintothestack
named InspireA
(b) Writethefunctionpop_words(N)topoptopmostwordfromthestackand
return it. if the stack is empty, the function should display “Empty”.
31 PredicttheoutputofthePythoncodegiven below: 3
Con1="SILENCE-HOPE-
SUCCEss@25" Con2=""
i=0
while i<len(Con1):
ifCon1[i]>='0'andCon1[i]<='9':
Num=int(Con1[i])
Num-=1
Con2=Con2+str(Num)
elifCon1[i]>='A'andCon1[i]<='Z':
Con2=Con2+Con1[i+1]
else:
Con2=Con2+'^'i+
=1
print(Con2)

Q Section-D(4 x4 = 16Marks) Ma
No. r
ks
32 Considerthe followingtable namedVehicle and state thequeryor state theoutput 4
Table:-Vehicle
VID LicensePlate VType Owner Cost Contact State
1 MH12AB1234 Car RajKumar 65 9876543210 Maharastra
2 DL3CDE5678 Truck ArjithSingh 125 8765432109 New Delhi
3 KA04FG9012 Motor cycle PremSharma 9123456789 Karnataka
4 TN07GH3456 SUV ShyadUsman 65 9987654321 Tamil Nadu
5 KA01AB1234 Car Devidjhon 65 9876543210 Karnataka
6 TN02CD5678 Truck AnjaliIyer 125 8765432109 Tamil Nadu
7 AP03EF9012 Motor cycle PriyaReddy 9123456789 AndhraPrades
h
(A)
(i) Todisplaynumberof different vehicletypefrom the table vehicle
(ii) Todisplaynumberof records entered vehicletype wisewhoseminimum cost is
above80
(iii) Toset thecost as45 for thosevehicleswhosecostis notmentioned
(iv) Toremoveallmotorcyclefromvehicle
O
R
(B)
(i) SELECTVTYPE,AVG(COST)FROMVEHICLEGROUPBY VTYPE;
(ii) SELECTOWNER,VTYPE,CONTACTFROMVEHICLEWHEREOWNERLI
KE “P%”;
(iii) SELECTCOUNT(*)FROMVEHICLEWHERECOSTISNUL
L; (iv)SELECT MAX(COST) FROM VEHICLE;
33 ACSVfile“Movie.csv”containsdataofmoviedetails.Eachrecordofthefilecontainsthe 4
following data:
1. Movieid
2. Movienam
e 3.Genere
4. Language
5. Released date
Forexample, asamplerecordof thefilemay be:
["tt0050083",’‘12AngryMenis’,’Thriller’.’Hindi’,’12/04/1957’]
Writethefollowingfunctions toperformthespecified operationsonthis file
(i) Readallthedatafromthefileintheformofthelistanddisplayallthoserecords for
which language is in Hindi.
(ii) Count thenumberof records in thefile.
34 SalmanhasbeenentrustedwiththemanagementofAirlinesDatabase.Heneedstoaccesssome 4
information from Airports and Flights tables for a survey. Help him extract the following
information by writing the desired SQL queries as mentioned below.
Table-Airports
A_ID A_Name City IATACode
1 IndiraGandhiIntl Delhi DEL
2 ChhatrapatiShivaji Intl Mumbai BOM
3 RajivGandhiIntl Hyderabad HYD
4 KempegowdaIntl Bengaluru BLR
5 ChennaiIntl Chennai MAA
6 NetajiSubhas ChandraBoseIntl Kolkata CCU
Table-Flights
F_ID A_ID F_No Departure Arrival
1 1 6E 1234 DEL BOM
2 2 AI5678 BOM DEL
3 3 SG 9101 BLR MAA
4 4 UK1122 DEL CCU
5 1 AI101 DEL BOM
6 2 6E 204 BOM HYD
7 1 AI303 HYD DEL
8 3 SG 404 BLR MAA
i) Todisplayairportname,city,flightid,flightnumbercorrespondingflightswhose
departure is from delhi
ii) Displaytheflight details ofthoseflights whosearrivalis BOM, MAAor CCU
iii) Todeleteall flightswhoseflightnumber startswith 6E.
iv) (A)TodisplayCartesianProductoftwotables
OR
(B)To displayairport name,cityand correspondingflight number
35 Atable namedEvent in VRMALLdatabasehasthefollowingstructure: 4

Field Type
EventID int(9)
EventName

varchar(25) EventDate
date
Description

varchar(30)
WritethefollowingPythonfunctiontoperformthespecified operations:
Input_Disp():toinputdetailsofaneventfromtheuserandstoreintothetableEvent.The function
should then display all the records organised in the year 2024.

AssumethefollowingvaluesforPythonDatabaseConnectivit
y Host-localhost, user-root, password-tiger

QNo. Section-E( 2 x5 = 10 Marks) Marks


36 MsJoshikaistheLabAttendantoftheschool.Sheisaskedtomaintaintheproject 5
details of the project synopsis submitted by students for upcoming Board
Exams. The information required are:
-prj_id-integer
-prj_name-string
-members-integer
-duration-integer(noof months)
Asaprogrammer oftheschooluhavebeenaskedtodothisjobforJoshikaanddefine
the following functions.
i) Prj_input()-toinputdataofaprojectofstudent andappendtothebinary
file named Projects
ii) Prj_update()-toupdatetheprojectdetailswhosememberaremorethan3
duration as 3 months.
iii) Prj_solo()-toreadthedatafromthebinaryfileanddisplaythedataofall
project synopsis whose member is one.
37 P&O Nedllyod Container Line Limited has its headquarters at London and 5
regional
officeatMumbai.AtMumbaiofficecampustheyplannedtohavefourblocksforHR,
Accts, Logistics and Admin related work. Each block has number of computers
connected to a network for communication, data and resource sharing
Asanetworkconsultant,youhavetosuggestbestnetworkrelatedsolutionsforthe
issues/problems raised in (i) to (v), keeping in mind the given parameters

REGIONALOFFICEMUMBAI

London Head HR
ADMIN
Office
Accts Logistics

Distances between various


blocks/locations: Admin to HR

500m
AcctstoAdmin 100m
AcctstoHR 300m
Logisticsto Admin 200m
HR to logistics 450m
Acctstologistics 600m
Numberofcomputersinstalledatvariousblocksareasfollows:
Block No of computers
ADMIN 95
HR 70
Accts 45
Logistics 28
i) SuggestthemostappropriateblocktoplacetheseverinMumbaioffice.
Justify your answer.
ii) Statethebestwiredmediumtoefficientlyconnectvariousblockswithin
the Mumbai Office.
iii) Drawtheidealcablelayout(blocktoblock)forconnectingtheseblocks
for wired connectivity.
iv) The company wants to conduct an online meeting with heads of
regional
officeandheadquarter.Whichprotocolwillbeusedfortheeffectivevoice
communication?
v) Suggestthebestplacetohousethe following
a)Repeater b) Switch
KENDRIYAVIDYALAYASANGATHAN,CHENNAIREGION
CLASS: XII SESSION: 2024-25
PREBOARDIMARKINGSCHEME
COMPUTER SCIENCE (083)
Timeallowed:3Hours Maximum Marks: 70

QNo. Section-A(21 x1=21Marks) Marks


1 False 1
(1markforcorrectanswer)
2 iv) [2,14,3,7] 1
(1markforcorrectanswer)
3 ii)4.6 1
(1markforcorrectanswer)
4 ii)['', 'hinese', 'ontinental'] 1
(1markforcorrectanswer)
5 so ie 1
(1markforcorrectanswer)
6 ii)100 1
(1markforcorrectanswer)
7 ii) print(farm[‘sheep’,’hen’]) 1
(1markforcorrectanswer)
8 iii) Replacealloccurrencesof‘e’to‘h’ 1
(1markforcorrectanswer)
9 iii)2 1
(1markforcorrectanswer)
10 file.seek(0) 1
(1markforcorrectanswer)
11 iii) raise 1
(1markforcorrect answer)
12 ii) 5500.0%6000$ 1
(1markforcorrectanswer)
13 ALTER(orALTER TABLE) 1
(1markforcorrectanswer)
14 iii) Customersdetailswhosecode’ssecondletterisA 1
(1markforcorrectanswer)
15 i) (20,34) 1
(1markforcorrectanswer)
16 c)count(col) 1
(1markforcorrectanswer)
17 a)IP 1
(1markforcorrectanswer)
18 c)Modem 1
(1markforcorrectanswer)
19 PacketSwitching 1
(1markforcorrectanswer)
Q20andQ21areAssertion(A)andReason(R)basedquestions.Markthecorrect
choice as:
(A) BothAand Raretrue andR isthecorrectexplanationfor A
(B) BothAand Raretrueand Risnot thecorrect explanationfor A
(C) Ais Truebut R is False
(D) Ais Falsebut Ris True
20 A)BothA andBaretrue andR isthecorrectexplanation for A 1
(1markforcorrectanswer)
21 D)A is FalseBis True 1
QNo. Section-B( 7x2=14 Marks) Marks
22 Difference1mark 2
Example½mark each
23 a) AssignmentOperators=+=-=*=**=/=//= %= 2
b) Logical Operators not and or (anytwofromeach)
(1/2 mark for each correct operator)
24 2
(i) A)L1.pop(4)
Or
B)a=max(L2)orprint(max(L2)

(ii) (A)L1.append(L2
) OR
(B) L2.insert(1,15)
25 Identifythecorrectoutput(s)ofthefollowingcode.Alsowritethe minimumandthe 2
maximum possible values of the variable Lot
Minimum value possiblefor Lot:
4
MaximumvaluepossibleforLot:8
Possible outputs are : i) and ii)
26 IdentifyPrimaryKeyandCandidateKeypresent ifanyinthebelowtablename 2
Colleges. Justify
PrimaryKey: Cidits unique
CandidateKey: Cid, Name, PhoneNumberas theyarehaveunique values
27 (I) 2
(A) UNIQUE,NOTNUL
L OR
(B) NOTNULL(PRIMARYKEYCANBEGIVENMARK
) (II)
(A) ALTERTABLEflightADDPRIMARY KEY(F_id);
OR
(B) ALTERTABLE CUSTOMERDROPREMARKS;
28 STARAdvDisAdv½markeach 2
BUSAdvDisAdv½ mark each
OR
DNSdefinition1 mark,IP purpose1 mark

QNo. Section-C(3 x3 = 9 Marks) Marks


29 a)Openingandclosingfile½mark 3
Read() ½ mark split() ½ mark
Loop½markuppercasechecking½mark
Output display ½ mark
OR
b)
Openingandclosingfile½mark
Readlines() ½ mark
Loop½markcountingnoofwords½mark
Output display ½ mark
30 (1/2foridentifyingevennumbers) 3
(1/2mark forcorrectlyaddingdata to stack)
(1/2markforcorrectlypopingdataonthestackand1/2markforchecking condition)
(1/2markforcorrectlydisplayingthedatawithnone)
(1/2 mark for function call statements)
OR
(1½markfor correctfunctionbody;Nomarksfor anyfunctionheader asit
wasapart ofthe question)
31 ILENCE-^OPE-^UCCEs^^^14correcto/p3mark 3

Q Section-D(4 x4 = 16Marks) Ma
No. r
ks
32 i) SELECTCOUNT(DISTINCTVTYPE)FROM VEHICLE; 4
ii) SELECTVTYPE,COUNT(*)FROMVEHICLEGROUPBYVTYPEHAVI
NG MIN(COST)>80;
iii) UPDATEVEHICLESETCOST=45WHERECOST ISNULL
iv) SELECTOWNER,VTYPE,CONTACTFROMVEHICLEWHEREOWNERLI
KE “P%”;
OR
i)
+ + +
|VTYPE |AVG(COST)|
+ + +
| CAR | 65.0000 |
|truck | 125.0000 |
|MoterCycle | NULL |
| SUV | 65.0000 |
|MOTOR CYCLE| NULL|
+ + +
ii)
+ + + +
|OWNER |VTYPE |CONTACT |
+ + + +
|PremSharma |MoterCycle |9987654321|
|PRIYAREDDY |MOTORCYCLE|9123456789|
+ + + +
iii)
+ +
|COUNT(*)|
+ +
| 2|
+ +
iv)
+ +
|MAX(COST)|
+ +
| 125 |
+ +
33 (½ mark for opening in the file in right 4
mode)
(½markforcorrectlycreatingthereaderobject)
(½ mark for correctly checking the
condition) (½ mark for correctly displaying
the records) OR
(½ mark for opening in the file in right
mode)
(½markforcorrectlycreatingthereaderobject)
(½ mark for correct use of counter)
(½markfor correctlydisplayingthecounter)
34 i) selectairports.a_id,city,f_id,F_nofromflights,airportswhereflights.f_id=airports. 4
a_id and departure="DEL";
ii) select*fromflightswherearrival="bom"orarrival="Maa"orarrival="ccu";
iii) deletefrom flightswhereF_nolike"6E%";
iv) (A)select*fromflights,airports
; OR
(b) selectairports.a_id,city,flights.f_idfromflights,airportswhere
airports.a_id=flights.a_id;
35 4
#interfacecode
importmysql.connectorasm
n def Input_Disp():
con=mc.connect(host="localhost",user="root",password="tiger",database="VRMALL"
) cur=con.cursor()
print("EnterEventDetails
:") eid=input("ID:")
ename=input("NAME:")
edate=input("DATE:")
des=input("Description:"
)
query="insertintoEventvalues("+eid+",'"+ename+"','"+edate+"','"+des+"')"cur.e
xecute(query)
con.commit()
print("RecordInserte
d")

print("Details of Event organised in year 2024")


query="select*fromEventwhereeventdatelike'2024'"
cur.execute(query)
data=cur.fetchall()
print("ID NAME DATE DESCRIPTION")
for rec in data:
print(rec[0],rec[1],rec[2],rec[3],sep=
"")
con.close()
oranyotherrelavantcode
import ½ mark
Connectivitystmt½mark
Cursorcreationquerycreation,execute(),commit½markeach
Query creation, cursor execution ½ mark each
Fetchingdataand displayloop ½ markeach
QNo Section-E(2x5=10 Marks) Mark
s
36 #binaryfile
def Prj_input():
file=open("Projects.dat","ab")
print("Enter Project Details:")
pid=int(input("ID:"))
pname=input("NAME:")
mem=int(input("MEMBERS:"
))
dur=int(input("DURATIONINMONTHS:
")) rec=[pid,pname,mem,dur]
pickle.dump(rec,file)
file.close()
print("datainserted
")
def Prj_update():
file=open("Projects.dat","rb+")
try:
while True:
pos=file.tell()
rec=pickle.load(file)
5
if rec[2]>3:
rec[3]=3
file.seek(pos)
pickle.dump(rec,fil
e)
exceptEOFError
: pass
finally:
file.close()
print("Recordmodified
")
def Prj_solo():
file=open("Projects.dat","rb")
try:
print("PROJECT DETAILS")
print("IDNAME MEMBERSDURATION")

importpickle½ mark
input and close ½ mark ,insert 1
mark try except block ½ mark loop
½ mark
readingrecords,updation½markeach
try catch block ½ mark
loop½ mark fetchinganddisplay½ markeach
37 i) ServertobeplacedinADMINblockasithasmaximumnumberof 5
computers(70 30 traffic rule)
ii) Coaxialcable/fiberoptics
iii) Startopologyoranyotherlayout

ACCTS LOGISTICS

ADMIN

HR

iv) VoIPVoiceoverinternetProtoco
l v)
a) Repeater–distancemorethen90 m–all
..iffiberoptical cablethen no repeater
b) Switch-ineachblock astoconnectcomputers
KENDRIYAVIDYALAYASANGATHAN:JABALPURREGION FIRST
PRE-BOARD (2024-25)
CLASS: XII Time allowed: 3 Hours
MaximumMarks:70 COMPUTER SCIENCE (083-
THEORY)

GeneralInstructions:
● Thisquestionpapercontains 37 questions.
● Allquestionsarecompulsory.However,internal
choiceshavebeenprovidedinsomequestions. Attempt only one of the choices in such
questions
● Thepaperis dividedinto 5Sections-A,B,C, Dand E.
● SectionAconsists of21questions(1to21).Eachquestioncarries1Mark.
● SectionBconsists of7questions(22to28).Eachquestioncarries2 Marks.
● SectionCconsists of3questions(29to31).Eachquestioncarries3 Marks.
● SectionDconsists of4questions(32to35).Eachquestioncarries4 Marks.
● SectionEconsists of2questions(36to37).Eachquestioncarries5 Marks.
● Allprogrammingquestions aretobe answeredusingPythonLanguageonly.
● IncaseofMCQ,text ofthecorrect answershouldalsobewritten.

QNo. Section-A(21x1=21Marks) Marks


1. State-Trueor false:
Pythoninterpreterhandlessemanticerrorsduringcode execution. (1)
2. WhichofthefollowingwillreturnFalse:
A)not(True andFalse) B)True or False (1)
C)not (TrueorFalse) D)not(FalseandFalse)
3. Whichofthefollowingfunctionwillhelpinconvertingastringtolistwith
elements separated according to delimiter passed? (1)
A) list( ) B) split() C)str( ) D)shuffle()
4. What is the output of the following?
OCEANS=('pacific','arctic','Atlantic','souther (1)
n') print(OCEANS[4])
A) ‘southern’ B) (‘southern’) C) Error D)INDEX
5. Whatistheoutputofthefollowing (1)
x="Excellent day"
print(x[1::3])
A)x B)xlnd C) error D) dnlx
6. Whatcanbethepossibleoutputofthefollowingcode:
defElement(x):
z=""
fory in x:
if not y.isalpha():
z=z+z.join(y) (1)
print(z)
Element("W2e0Py2th4n")#FunctionCall
A)2 B)02 C)024 D) 2024

1
7. IfD={‘Mobile’:10000,‘Computer’:30000,‘Laptop’:75000}thenwhichofthe
following command will give output as 30000
A) print(D) B)print(D['Computer'])
C)print(D.values()) D)print(D.keys()) (1)
8. Whichofthe following is notcorrect?
(A) deldeletes thelist ortuplefrom thememory
(B) removedeletes thelist or tuplefrom thememory (1)
(C) popisusedto delete anelement ata certain position
(D) pop(<index>)andremove(<element>)performs thesame operation
9. A relation in a database can have numberof primary key(s)?
A)1 B)2 C) 3 D)4 (1)
10. Whatisthevalueof‘p’andhowmanycharacterswillbethereinthevariable
‘data’ in the following statement (1)
withopen("lists.txt","r",encoding="utf-8")asF:
data = F.read(100)
p=F.seek(10,0)
print(p)
A)10,100 B)100,10 C)10,110 D)110,10
11. Writethenameofblock/command(s)canbeusedtohandletheerror/exceptionin (1)
Python.
12. Whatwillbetheoutputofthefollowingcode?
def add():
c=
1
d=
1 (1)
while(c<9):
c=c+
2
d=d*
c
print(d,end="$"
) return c
print(add( ),end="*")

A)945$9* B)945$9 C)9*945$ D)9$945*


13. Whichtypeofcommandisused to deletethestructureof the relation? (1)
A)DDL B)DML C)Select D)Cannotdeletestructure
14. Whatwillthefollowingqueryshow?
(consideringatablestudentwithsomecolumns)
SELECT * FROM students WHERE age in (17,19,21);
A) Showtuplesofstudentstablewithalltheagevaluesfrom17to21 (1)
B) Showtuplesofstudentstableonlywiththeagevalues17,19,21
C) Showtuplesofstudentstableonlywiththeagevaluesotherthen17,19,21
D) Showtuplesofstudentstablewithalltheagevaluesoutsidetherange17to21
15. WhichofthefollowingisnotadatatypeinPython
A)date B)string C)tuple D)float (1)
16. Whichofthefollowingisnotanaggregatefunction?
A)max( ) B)count() C)sum() D)upper() (1)

2
17. Whichofthefollowing protocol helpsin e-mail services?
A) FTP B)PPP C)UDP D)MIME (1)
18. Inordertocoveralong-distancenetworkwhichofthefollowingdevicewillbe (1)
helpful?
A) Modem B)Gateway C)Switch D)Repeater
19. WhatisSIM&GPRS? (1)
A) SmallInformationMachine&GlobalPeopleResearchandScience
B) SubscriberIdentityModule&GeneralPacketRadioService
C) SubscriberInformationModule&GeneralPublicRadioShrive
D) Noneof these

Q20andQ21areAssertion(A)andReason(R)basedquestions.Markthecorrect choiceas:
A) BothA andR aretrueandR isthe correctexplanation forA
B) BothAand RaretrueandRis notthecorrectexplanationforA
C) Ais Truebut RisFalse
D) Ais Falsebut RisTrue

20. Assertion(A):InarelationofRDBMS,redundancycanbe reduced.


Reasoning(R):Thiscanbedonewiththehelpofjoinoperationsinbetween relation.
(1)
21. Assertion(A):A functionin Pythoncan haveanynumberof arguments.
Reasoning(R):variablelengthparametercanbeusedtodealwithsuchnumberof
arguments. (1)
Q No Section-B(7x2=14Marks) Marks
22. a) Explaindictionary with example?
b) Whatisthe datatypeof (i)x=10 (ii) x=10,20 (2)
23. Explain‘in’operatorandwriteasmallcodeinPythontoshowtheuseof‘in’ (2)
operator.
24. ConsiderT=(10,20,30) andL=[60,50,40] answerthequestionIandII (1)
(I) Writecommand(s) to add tupleT in listL.
OR
Writecommand tofindand deleteelement 20from tuple T
(II)Writecommandtoadd50 inL atposition 2. (1)
OR
Writecommandtodelete thevariableT.
25. Identifythecorrectoutput(s)ofthefollowingcodeandwritetheminimumandthe
maximum possible values of the variable b.
import random
a="ComputerScience"
I=0
while (I<3):
b=random.randint(1,len(a)-1) (2)
print(a[b],end='$')
I+=2

A)C$m$ B)m$p$ C)c$n$ D)c$e$c$

3
26. WriteafunctionnamedRECORDS()whichcanopenabinaryfilenamed
‘district.dat’containingthepopulationdataofallthedistrictsofastate.The
function will ask for the name of the district to be searchedin file and display (2)
itsdata from the file. [Note: Name of dist. is stored at 0 index of record in
district.dat]
27. [I]
A) Benjaminadatabaseadministratorcreatedatablewithfewcolumns.He
wants to stop duplicating the data in the table. Suggest how he can do
so.
OR
B) Consider two tables student (rno, name, class) and marks (rno,
mrk_obt, percent). You as a database administrator how will your stop
redundancy of data in the table students and how the tables students (2)
and marks can be connected with each other
[II]
A)WriteanSQLcommandtochangethedatatypeofacolumnnamedprice to
number (10,2) in a table named stationary
OR

B) Write an SQL command to change the values of all the rows of the
column price of table stationary to Null
28. A) Differencebetweenstar andmeshtopology.
OR (2)
B) Writethefullformsof (i)VoLTE (ii)GSM

QNo. Section-C(3x3=9Marks) Marks


29. A) WriteaPythonfunctionthatdisplaysallthewordsstartingfromtheletter‘C’
in the text file "chars.txt".
OR (3)
B) WriteaPythonfunctionthatcanreadatextfileandprintonlynumbersstored in
the file on the screen (consider the text file name as "info.txt").
30. A) You have a stack named Inventory that contains records of medicines.
Each record is represented as a list containing code, name, type and
price.
Write the following user-defined functions in Python to perform the
specified operations on the stack Inventory:
i. New_In (Inventory,newdata):Thisfunctiontakesthestack
Inventoryand newdata as arguments and pushes the newdata to
Inventory stack.
ii. Del_In(Inventory): This function removes the top most record from
the stack and returns it. If the stack is already empty, the function (3)
should display "Underflow".
iii. Show_In(Inventory): This function displays the topmost element of
the stack without deleting it. If the stack is empty, the function
should display 'None'.

4
OR
B) Writethedefinitionofauser-definedfunction`Push(x)`whichaccepts astring
in parameter `x` and pushes only consonants in the string `N` into a Stack
named
`Consonants`.
Writefunction Display()todisplayall elementofthe stack.

Forexample:x=“Python”
Thenthestack`Consonants’shouldstore: [‘P’,’y’,’t’,’h’,’n’]
31. Predicttheoutputofthefollowingcode:
d={}
V="programs"f
or x in V: (3)
ifxind.keys():
d[x]=d[x]+1
else:
d[x]=
1 print(d)
OR
Predicttheoutputofthefollowingcode:
V="interpreter"
L=list(V)
L1=""
forx in L:
ifx in ['e','r']:
L1=L1+x
print(L1)

QNo. Section-D(4x4=16Marks) Mark


s
32. Considerthetablesgivenbelow
Watches
Id Wname Price Type Qty
W01 High Time 1200 Common 75
W02 Lifeline 1600 Gents 150
W03 Wave 780 Common 240
W04 Timer 950 Gents 460
W05 Goldenera 1760 Ladies 250

WSale (4)
Wid QSold Qtr
W01 25 1
W02 23 1
W03 2 1
W04 10 2
W05 12 2
W03 22 3
W04 22 3
W02 23 3

5
“Note:Consider the tablecontains theaboverecords.”
A) Writethe queriesforthefollowing:
i) Todisplaythetotalquantitysold(qsold)ofwsale forqtrnumber 3.
ii) Todisplaythedetailsofwatchesin descendingorderof qty.
iii) Todisplay thetotal quantityof watches.
iv) To display thewnameand maximum qsold from the table
watchesandwsale sold in qtr=1
OR
B) Writethe output
i) Selectsum(price)fromwatches;
ii) Select*fromwatchedwherewname'%e';
iii) Selectsum(qty),typefromwatchesgroupbytype;
iv) Selectwname,price,qtr fromwatches,wsold
wherewatches.id=wsale.wid and watches.type=’Common’;
33. Acsvfile"candidates.csv"containsthedatacollectedfromanonlineapplicationform
for selection of candidates for different posts, with the following data
 CandidateName
 Qualification (4)
 Percent_XII
 Percent_Qualification
E.g.[‘SmithJones’,‘MTech’,80,76]
WritethefollowingPython functionsto performthespecifiedoperationsonthis file:
a) READ()functionwhichcanreadallthedatafromthefileanddisplayonlyrecords
with Percent_XII more than 75
b) IDENTIFY()functionwhichcanfindandprintthenumberofsuchrecordswhichare
having Percent_XII not more than 75
34. A school is maintaining the records of his departments and their in-charges in the
following table and wants to see the data according to the following conditions.
Study the following table and write the queries for (i) to (iii) and output for (iv)

Table:Departments

D_No D_name D_Incharge Date_join grant


D94 Physics Binny 12-10-2021 34000
D46 Chemistry Virat 24-12-2010 49500
D78 Biology Jimmy 10-05-2001 79000 (4)
D99 Geography Adams 05-09-2006 62000
D23 Primary Ajay 15-06-2009 Null

(i) Todisplaycompletedetailsofthosedepartmentswheredate_joinislessthen
01-01-2010
(ii) Todisplaythedetailsofdepartmentswiththenameofinchargescontaining
m in their name.
(iii) Toincreasethegrantofdepartmentby1200ofD_noeitherD99orD23.
(iv) Selectd_name, grantfrom department wheregrant is null;
OR
Selectsum(grant)fromdepartmentwheredate_join>’10-10-2020’;

6
35. Consideradatabasenamed‘DB’containingatablenamed‘Vehicle’withthefollowing
structure
Field Type
Model char(10)
Make_year Int(4)
Qty Int(3) (4)
Price Number(8,2)

WritethefollowingPythonfunction toperformthefollowingoperation asmentioned:


1. Add_Vehicle()-which takesinput ofdataandstoreitto thetable
2. Search_vehicle()–whichcansearchamodelgivenbyuserandshowitonscreen
*Assumethefollowing forPython– Databaseconnectivity:
Host:localhost, User:root, Password:root
Q.No SECTIONE(2X5=10Marks) Mark
. s
36. Rajiv Kumar is an owner of a company willing to manage the data of his office
employeesliketheirbiodata,salarycentrallyforallhisofficeslocatedinthestateof
Karnataka.
Heplannedtomakeadatabasenamed‘company’withthetable‘staff’thatcontains
following structure
- ID–integer(4)
- Name–string(30)
- Designation–string(10)
- Birth_date–date
- Salary-decimal(10,2)

Youashisdatabaseadministratorwritethefollowingqueries(I) to(IV)

(I) Create atable ‘staff’withabovestructureandidasprimary key. (2)


(II) Displayalltherecordswithdesignation‘Sales Executive’ (1)
(III) Tochangethedesignation=‘Assistant’ofallthestaffhavingsalaryfrom (1)
15000to 17000 (both values included)
(IV) Todisplaythetotalnumberof recordswithnameendingatletter ‘j’ (1)
37. PK International is
No.ofcomputers in an
theadvertising
building agency who is setting up a new office in
Distancebetweenbuildings
Admin 10 Admin-Finance 96
Finance 10 Admin-Development 58
Development 46 Admin-Organizers 48
Organizers 25 Finance-Development 42
Finance-Organizers 35 (5)
Development-Financers 40

Finance
Organizers

7
Development
Admin
i) Suggestthemostappropriatelocationoftheserverinsidetheabovecampus.
Justify your choice.
ii) Whichhardwaredevicecanbeusedtoconnectallthecomputerswithineach
building?
iii) Drawthecablelayoutforeconomicandefficientlyconnectvariousbuildings
within the campus?
iv) Whetherrepeaterisrequiredforyourgivencablelayout?YesorNo?Justify
your answer.
v) A)Giveyourrecommendationforlivevisualcommunicationbetweenallthe
offices and customer located in different cities
a) VideoConferencing
b) Email
c) Telephony
d) InstantMessaging
OR
B)Whattypeofnetwork(PAN,LAN,MANorWAN)willbesetup among the
computers connected in this campus?

8
KENDRIYAVIDYALAYASANGATHAN:JABALPURREGION
PREBOARD-1 (2024-25)
COMPUTERSCIENCE (THEORY)
CLASS: XII Time allowed: 3 Hours

MaximumMarks:70 MarkingScheme
GeneralInstructions:
● Incaseanydoubtregardingtheanswertheevaluatorcancheckbyhimself/
herselfanddotheneedful

QNo. Section-A(21x1=21Marks) Marks


1. False (1)
2. C)not (TrueorFalse) (1)
3. B) split() (1)
4. C) error (1)
5. B)xlnd (1)
6. D)2024 (1)
7. B)print(D['Computer']) (1)
8. B)remove deletes thelist or tuplefrom the memory (1)
9. A)1 (1)
10. B)100,10 (1)
11. try…exceptblock (1)
12. A)945$9* (1)
13. A)DDL (1)
14. B)Showtuplesofstudentstableonlywiththeagevalues17,19,21 (1)
15. A)date (1)
16. D)upper (1)
17. D)MIME (1)
18. D)Repeater (1)
19. B)Subscriber IdentityModule&GeneralPacketRadioService (1)
20. B)BothA andR aretrueandR isnot thecorrect explanationforA (1)
21. A)BothAandR aretrue andRisthecorrect explanationforA (1)
Q No Section-B(7x2=14Marks) Marks
22. a) Eitherdefinition ofdictionaryor exampleof dictionary 1 mark
b) (i)x=10integer ½ mark (ii)x=10,20tuple ½ mark
23. Relevantexplanationaboutinoperator 1 mark
Eg.
A=”welcome 1 mark
” if ‘e’ in A: exampl
print(“founda vowel”) e
orany codethat demonstratetheuseof in operator
24. ConsiderT=(10,20,30)andL=[60,50,40]answerthequestionIandII
(I)
L.append(T) 1mark
OR OR
AsTistupledeletionofanelementistupleisnotpossibledueto its 1 mark
immutable nature.(any relevant correct reason)
(II)
L.insert(50,2) 1mark
OR OR
delT 1 mark

Page:1/
5
25.
B) m$p$ C) c$n$ Foreachcorrectanswer½mark

Value of bminimum 1and maximum 14


½markforeachminimumand maximum
26. Anyrelevantcodewithfollowingmarksdistribution
½markforcorrectfunctiondeclaration
1 ½mark for logic (2)

import pickle
defRECORDS():
with open(“district.dat”,”r”) as file:
name=input(“Enternameofdistrict”)
try:
while(1):
a=pickle.load(file
) if a[0]==name:
print(a)
exceptEOFError:
break
oranyrelevantcorrectcode
27. (I)
A) UseofPrimarykey orAnyrelevantcorrect answer 1 mark
OR
B) Use of Primary key for rno in students table and use of foreign key in
marks table for connecting the two tables or Any relevant correct
answer 1mark

(II) (2)
A) Altertablestationary modify(pricenumber(10,2); 1 mark
OR
B) Updatetablestationarysetprice=Null;
28. A) Any 2 correct difference between star and mesh topology -
2marks (partial marks can be awarded on partial correct (2)
answer).
OR
B) (i)VoLTEVoice over Long Term Evolution 1 mark
(ii) GSM GlobalSystem forMobile communication 1 mark
QNo. Section-C(3x3=9Marks) Marks
29. 1½markforlogic,½markforindentation½markforcorrectfileopening
command , ½ mark for print command
(3)
A)withopen(“chars.txt”,”r”)asfile:
d=file.read()
WL=d.split()
forwinWL:
ifw[0]==’c’orw[0]==’C’:
print(w)
oranyothercorrectrelevantcode
OR
A)withopen(“info.txt”,”r”)asfile:
Page:2/
5
d=file.read()
forx in d:
if x.isdigit():
print(x)
oranyothercorrectrelevantcode

30. 1½markforlogic,½markforindentation½markforvariabledeclaration,
½markforprintcommand
A)
Inventory=[]
defNew_In(Inventory,newdata):
Inventory.append(newdata)

defDel_In(Inventory):
if
len(Inventory)==0: (3)
print(“NothingtoPOP”)
else:
Inventory.pop()

defShow_In(Inventory):
forpinrange(len(Inventory)-1,-1,-1):
print(Inventory[p])

code=input(“Code”)
name=input(“Name”
) price=input(“Price)
L=[code,name,price]
New_In(Inverntory,
L) Del_In(Inventory)
Show_In(Inventory)

Oranyothercorrectrelevantcode

OR
B)
N=”

Consonants=[]
def Push(x):
forp in x:
ifpnotin[‘a’,’A’,’e’,’E’,‘i’,’I’,’o’,’O’,‘u’,’U’]:
N=p
Consonants.append(N)
defDisplay():
forpinrange(len(Inventory)-1,-1,-1):
print(Consonants[p])
Push(“Welcometostacks”)
Display()

Oranyothercorrectrelevant code.
Page:3/
5
31. {'p': 1, 'r': 2, 'o': 1, 'g': 1, 'a': 1, 'm': 1, 's': 1} 3 marks
(partialmarking maybegiven)
OR
erreer 3marks (3)
(partialmarking
maybegiven)
QNo. Section-D(4x4=16Marks) Marks
32. A)Writethequeries forthefollowing:
i) Selectsum(qsold)from wsalewhereqtr=3;
ii) Select*fromwatchesorderbyqty desc;
iii) Selectsum(qty)from watches;
iv) Selectwname,max(qsold)fromwatches,wsalewhere

watches.id=wsale.widand qtr=1;
OR
B)Writethe output
i)Sum(price) (4)
6290
ii)
Id Wname Price Type Qty
W01 High Time 1200 Common 75
W02 Lifeline 1600 Gents 150
W03 Wave 780 Common 240

iii) sum(qty) type


315 Common
610 Gents
250 Ladies

iv)
Wname Price Qtr
High Time 1200 1
Wave 780 3
33. ½markcorrectimportstatement
½markforopeningfilein correct mode
½mark formaking reader object
½markforprintstatement (4)
2 mark for logic
import csv
defREAD()
:
withopen(“candidates.csv”,“r”)ascsv_file:
reading=csv.reader(csv_file)
forxinreading:
if x[2]>75 :
print(x
)def IDENTIFY():
count=0
withopen(“candidates.csv”,“r”)ascsv_file:
reading=csv.reader(csv_file)
forxinreading:
Page:4/
5
if x[2]<=75 :
count=count+1
print(“numberof recordslessthen75%“ ,count)

oranyothercorrectrelevantcode
34. (I) Select*fromdepartmentswheredate_join<’01-01-2010’; 1
(II) Selectd_name,d_inchargefromdepartmentswhered_inchargelik 1
e ‘%m%;’
(III) Updatedepartmentssetgrant=grant+1200whered_noin(‘D99’,‘D23’) 1
(IV) d_name grant
Primary Null
OR
sum(grant) 1
34000

35. import mysql_connector 1 mar


connect=mysql.connector.connect(hostname=”localhost”,user=”r k for
oot”, password=”root”, database=”db”) connec
cur=connect.cursor() t ion
string
defAdd_Vehicle():
Model= input(“Enter model”) ½mar
Make_year=input(“Enteryear”) kfor
Qty= input(“Enter qty”) variabl
Price=input(“Enterprice”) e
Q=”insertinto Vehiclevalues(‘”+Model +”’,”+Make_year + “,”+Qty declara
+”,”+Price+”)” t ion
cur.execute(Q)
connect.commit()
½ mark
def Search_vehicle(): for
model=input(“Entermodeltosearch”) correct
Q=”select*fromVehiclewhereModel=’”+model+’” functio
cur.execute(Q) n
forx in cur: declarat
print(x) i on

2 marks
forlogic
Q.No. SECTIONE(2X5=10Marks) Marks
36. (I) Createtablestaff(IDint(4)primarykey,Namechar(30),Designation (2)
char(10) , Birth_date date, Salary numeric(10,2));
(II) Select*fromstaffwheredesignation=‘SalesExecutive’; (1)
(III) Updatestaffsetdesignation=’Assistant’wheresalarybetween15000an (1)
d 17000;
(IV) Selectsum(*)from staff wherenamelike “%j”; (1)

Page:5/
5
37. i) Developmentbuildingwithrelevantand correctexplanation 1
ii) Switch 1
iii) Anycorrectrelevantlayoutwith sameplacementofthe building 1
iv) Correct&Relevantanswerasper thelayoutgiven .bythe student 1
v) A)Video conferencing
OR 1
B)LAN

Page:6/
5

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy