Rt 12 CS RevisionPapers2025
Rt 12 CS RevisionPapers2025
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
Name="PythoN3@1" R="
if Name [x].isupper():
R-R+Name[x].lower()
R=R+Name[x].upper()
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)
print(min(t1) + max(t2))
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
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.
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.
SECTIONB
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
POP()-Popanddisplaythecontentofthestack.
31 3
ConsiderthetableACTIVITYgivenbelow:
Acode Activityna Me Particip Ants Prizemoney Scheduled Te
Num
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
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:
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))
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.
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)
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.
(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
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.
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
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.
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.
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
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-B(7x2=14Marks) Mark
Ans Immutabletypesarethosethatcanneverchangetheirvalueinplace.Theseare: integers, 2
22 float, string, tuple
Mutabletypesarethosewhosevaluescanbechangedinplace.Theseare:lists, dictionaries
(1markforeachcorrectdefinitionandexample)
(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-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)
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 )
1. StateTrueorFalse:
(1)
ThePythonstatementprint(‘Alpha’+1)isexampleofTypeErrorError
Ans:True
2. Whatidtheoutputoffollowingcodesnippet?
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)
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: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.
(1 marks+ 1Marks)
Giveexamplesforeachofthefollowingtypesof operatorsinPython:
23.
(2)
(I)AssignmentOperators
(II)Identity Operators
Ans:
1. Example1:=(SimpleAssignment)Usage:x=5(assignsthe
value 5to x)
2. Example2:+=(AddandAssign) :Usage:x+=3(equivalenttox
=x+3)
(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))
(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
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:(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
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)
(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:
(II) pop_movie(MovieStack):Thisfunctionpopsthetopmostmovierecord
from the stack and returns it. If the stack is empty, the function should
display "Stack is empty".
OR
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):
return movie_stack.pop()
defpeek_movie(movie_stack):
return "None"
returnmovie_stack[-1]
OR
(B)defpush_odd(M,odd_numbers):
if number % 2 != 0:
odd_numbers.append(number)
def pop_odd(odd_numbers):
returnodd_numbers.pop()
def disp_odd(odd_numbers):
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
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)
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:
(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
Table: SUBJECTS
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;
Field Type
productID int(11)
productNamevarchar(20)
price float
stockQty int(11)
(4)
WritethefollowingPythonfunctiontoperformthespecifiedoperation:
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)
(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
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.
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)
(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.
(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.
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
REGIONALOFFICEMUMBAI
London Head HR
ADMIN
Office
Accts Logistics
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
(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
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")
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.
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="*")
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
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
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)
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
(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)
Youashisdatabaseadministratorwritethefollowingqueries(I) to(IV)
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
Page:1/
5
25.
B) m$p$ C) c$n$ Foreachcorrectanswer½mark
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
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
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