You are on page 1of 8

Sampl

eQuest
ionPaper(
Ter
m-I
)
Cl
ass:XI
I
Ti
meAll
owed :90Minut
es
Subj
ect
:(083)Comput
erSci
ence Maxi
mum Mar
ks:35

Gener
ali
nst
ruct
ions:
Thepaperisdi
vi
dedinto3Secti
ons-A,
BandC.
Secti
onA,consi
stsofQuest
ion1to25andstudentneedtoattempt20quest
ions.
Secti
onB,consi
stsofQuest
ionnumber26t
o49andst udentneedt
oatt
empt20quest i
ons.
Secti
onC,consi
stsofQuest
ionnumber50t
o55andst udentneedt
oattempt5quest
ions.
All
questi
onscarr
yequalmarks(0.
77markperquesti
on).

Secti
on–A
Sect
ionAconsi
stsof25questi
ons,
att
emptany20quest
ions
1.Whichofthef
oll
owi
ngoperat
orsi
sthecor
rect A.S[ 3:]
opt
ionforpower
(ab)i
npy
thon?[
] B.S[ :
3]
A.a^b C.S[ -3:]
B.a* *b D.S{ :-3]
C.a^^b 6.Whichoft hefol
lowi
ngcommand(
s)wi
l
lcr
eat
e
D.a^*b ali
st?
[]
A.list1=l i
st(
)
2.Whatisther
etur
nty
peoff
unct
ioni
d? B.list1=[ ]
A. int C.list1=l i
st(
[1,
2,3]
)
B. float D.al lofthese
C. bool
D.di ct 7.Wr i
tetheoutputoft
hef
oll
owi
ng.
a=(23,34,
65,
20,5)
3.Aloopbecomesinf
ini
tel
oopi
facondi
ti
on pri
nt(a[0]
+a.
index(
5))
neverbecomes__
____
_ _
. A.28
B.29
A.TRUE C.27
B. FALSE D.26
C.Null
D.BothAandC 8.Whichofthefol
lowi
ngst
atementwi
l
lret
urnan
err
or?T1isatupl
e.
4.Whi
chl
i
neofcodepr
oducesaner
ror
?[]
A.T1+(23)
A."one"+'
two'
B.T1+[3]
B.1+2 C.Bot
hoftheabove
C."one"+"
2" D.Noneoftheabov
e
D.'
1'+2

9.Whatisprint
edbythefoll
owingstatement
s?
5.Whichofthefol
lowi
ngfuncti
onwi
ll
ret
urnt
he D1={"cat"
:17,"
dog":
6,"
elephant"
:23,
"bear
":
20}
fi
rstt
hreechar
actersofastri
ngs? pri
nt (
25 i
n D1)

1|
KVS–Regi
onal
Off
ice,
JAI
PUR|
Sessi
on2021-
22
D.Unknownv
ari
abl
e

13.WhatDoesst
ri
p()
funct
iondo?

A.True
B.False A.Remov esthetrai
l
ingorleadi
ngspaces,i
f
C.Error any.
D.None B.Delet
esthef i
l
e
C.Remov ethefi
leobject
10.I
dent
if
ycor
rectout
putf
ort
hef
oll
owi
ngcode. D.Remov esallt
hespacesbet weenwords
14.I
nwhichmodei
fthef
il
edoesnotexi
st,
then
thef
il
eiscr
eat
ed?
A.r
eadwr i
temode
B.writ
emode
C.readmode
deff
un4(
a,b=100)
: D.Alloft
hese
t
otal
=a+b
15.Whichofthef
oll
owingrepr
esentsmodeof
pr
int(
tot
al)
f
un4(
50,
20) bothwrit
ingandr
eadingbi
naryfor
matinfi
l
e?[
]
A.wb+
A.100 B.wb
B.120 C.w
C.150 D.w+
D.70
16.I
npython,
def
aul
tEOLchar
act
eri
s.
11.Consi
derthef
oll
owi
ngcodeandchooset
he A.\
n
corr
ectanswer. B.\
r
C.\
d
D.\
LK

17.Ifyouareopeni ngabi naryfi


l
ei nread mode,
thenfil
emustexistother wi
sewhat happens?
defnameage(name=”ki
shan”
,age=20)
: A.Compil
etimeer roroccur
retur
nage,name B.Run-
ti
meer rorraises
t=nameage(20,
”ki
shan”
) C.Notanyerr
orr ai
ses
pri
nt(
t[
1]) D.Noneofthese

A.kishan 18.I
dentif
yt heer rorint hefoll
owingcode:
B.20  
  
  
  
  
  
  
 i
mpor tpickle
C.(kishan,
20)  
  
  
  
  
  
  
 mix_dat a=[‘
hundr ed’
,2,[
3,4,
5]] 
 
D.(20,ki
shan)  
  
  
  
  
  
  
 wi
thopen( ‘
mi xeddata.
dat ’
,‘
rb’
)asf
out
:
 
  
  
  
  
  
  
  
  
  
 pickle.dump( mix_data, f
out)
12.Av
ariabl
edefinedout si
deofal
lfunct
ions.
[]
isknownas: A.Notanyerr
oristhere
A.Local variable B.wi
thopen(‘mixeddat
a.dat
’,
‘w’

B.Gl obalvariabl
e C.wi
thopen(‘mixeddat
a.dat
’,
‘wb’
)
C.St ati
cvariable D.Noneofthese

2|
KVS–Regi
onal
Off
ice,
JAI
PUR|
Sessi
on2021-
22
22.Whichinst
ancesorobj
ect
sret
urnbyt
hewr
it
er
19.Adit
iwroteacodet oopenfil
eas funct
ion.
myfil
e=open(“
contact
.dat
”,
”wb”)
Nowshewant st
owr i
tealistnamedasFr
iendLi
st
tothefi
le.whi
chcommand shemustuset owr i
te
data on fi
l
e :
[
K]
A.wri
ter
ows
B.wri
terow
[
K]C.wri
ter
A.dump(myfil
e,Fr
iendList) D.Noneofabov
e
B.dump(“Fr
iendLi
st,”myfil
e)
C.pi
ckl
e.dump( myfi
le,Fr
iendLi
st) 23.Whichoft
hef
oll
owi
ngi
snotaf
unct
ionofcsv
D.pi
ckl
e.dump( Fri
endList,myf
il
e) module? 

20.Thi
smet
hodi
susedt
ounpi
ckl
i
ngdat
afr
om a
bi
nary f
il
e:
[
K]
A.r
eadli
ne()
 
B.wri
ter
ow() 
C.r
eader(

[
K]D.wri
ter
()
A.dump
B.unpi
ckl
e 24.ACSVf i
leisal
soknownasa…. [
K]
C.l
oad A.Fl
atFile
D.seek B.3DFile
C.Str
ingFil
e
21.Whichofthefol
l
owingarethebot
hwr
it
ing D.Random Fil
e
andreadi
nginbinar
yformati
nf i
l
e?

2
[
K5.Del
] imiteri
ncsvf
il
emaybechanged.
A.wb A.True
B.w B.False
C.w+ C.BothTrueandFal
se
D.wb+ D.None

Secti
on–B
Sect
ionBconsi
stsof24quest
ions,
att
emptany20quest
ions.
26.What i st he l
engt
h of t
he gi
ven t
upl
e? 27.mykvi s bestint he worl
d.iam a best
t1=(
1,2,
(3,
4,
5)) student
.ilikecomput er.
A.1 Whatwi llbet heout putoft hefol
l
owi
ngcode?
B.2 my f
il
e=open( "
stu.t
xt")
C.3 str=myfile.r
eadli
nes()
D.4
l
count=l en(str
)

3|
KVS–Regi
onal
Off
ice,
JAI
PUR|
Sessi
on2021-
22
pri
nt(
lcount) my List=[ 1,
2,3,4,5,
6,
7,
8,9,
10]
myfil
e.cl
ose() newLi st=[]
A.1 foriinr ange(0,len(
my Li
st))
:
B.2 ifi%2==0:
C.3 newList.append(my Li
st[
i]
)
D.4 pri
nt(newLi st)
A.[1,3,5,7,
9]
28.Whatwi
l
lbet
heout
putoft
hef
oll
owi
ngcode B.[1,3,5,7]
segment
? C.[]
D.[1,2,3,4,
5,6,
7,8,9,
10]
L='
good'
L=[
1,2,
3] 32.Which ofthef ollowing st
atementopensa
n=2 bi
naryf
il
eresul
t.bi
ni nwr itemodeandwr itesdat
a
pri
nt(
L*n) fr
om ali
stL=[3.5,
2,4,8.9]onthebinar
yf i
l
e?
A.goodgood A.wit
hopen('r
esul t
.bin'
,'
wb'
)asf:
B.[
1,2,3,1,
2,3] pi
ckle.
dump(
L,f
)
C.Err
or
D.None

29.Whatwillbet heout
putwhent
hef
oll
owi
ng
codei
sexecuted? B.wi
thopen('r
esul
t.bi
n'
,'
wb')asf
:
digit
s=[ 0,1] pickl
e.dump(f
,L)
foriindigit
s: C.wi
thopen('r
esul
t.bi
n'
,'
rb'
)asf:
print
(i
) pickl
e.dump(f
,L)
else:
print
("
final
")
A.01
B.01fi
nal
C.0f
inal
D.00 D.wi
thopen('r
esul
t.bi
n'
,'
ab'
)asf
:
pickl
e.dump(f
,L)

33.Whichst atementaboutbinar
yfi
l
esi
str
ue?
30.Whatwillbet heout
putwhent
hef
oll
owi
ng A.Thef i
l
eext ensi
onis.dat
codei
sexecuted? B.Theyar enothumanr eadable
n=10 C.Thef i
l
est oressamef or
matasheldi
nmemory
sum =0 D.Alloftheabov e
i=1
whil
ei <=n: 34.Choosecorrectoutputforthef
oll
owi
ngcode
sum =sum +i defcheck(x,y):
i=i+1 ifx! =y:
pri
nt(
"Thesum i
s",
sum)
retur
nx+5
else:
A.10
retur
ny +10
B.0
print(check(10,5)
)
C.55
A.15
D.11
B.20
C.5
31.Whatwi
l
lbet
heout
putoft
hef
oll
owi
ngcode
D.10
segment
?

4|
KVS–Regi
onal
Off
ice,
JAI
PUR|
Sessi
on2021-
22
35.Whichoft hefol
l
owi
ngi
scor
rect
lyev
aluat
ed b)150@5
forthi
sfunct
ion? c)5@50
pow( x
,y,
z) d)100@10@

A.(
x**
y)/z 38.Fi
l
lupt owcodest
hebel atement
1wi
tht
hecor
rect
B.(
x/y)*z opt
ionfr
om thef oll
owing
C.(
x**
y)%z Import………………………#st at
ement1
D.(
x/y)/z AR =[20, 30,
40,50,60,70]
FROM =r andom. r
andrange(1,
3)
TO=r andom. r
andrange(2,
4)
36.Whatwillbetheoutputoft
hef
oll
owi
ngcode f
orKinrange( FROM, TO+1):
deff un2(
name,age): pr
int
(AR[
K],
end=’
#’)
pri
nt(
age,
name)
A)mat h
func2(25,
”Ramesh”)
B)r andom
A.agename
C)Random
B.25Ramesh
D)RANDOM
C.Ramesh, 25
39.Consi dert he f
oll
owing code and choose
D.Err
or
correctanswer (
A)
defnameage( name=”ki
shan”
,age=20)
:
37.Whatwil
lbet
heoutputoft
hef
oll
owi
ng
r
eturnage,
name
py
thoncode:
t=nameage( 20,
”ki
shan”
)
pri
nt(t[
1])
val=50
a.kishan
defdi
splay
(N):
b.20
gl
obal
val
c.(
kishan,
20) d.(
20,
ki
shan)

40.Givenaf il
e'stu.
txt
'
v
al =50
mykvi sbesti nthewor l
d.iam abestst
udent
.
ili
kecomput er
.
i
fN%14==0 Wh
:atwi llbet heout putofthef ol
lowi
ngcode?
my f
il
e=open( "
stu.t
xt"
)
str=my f
ile.
readli
nes()
l
count=l en(str
)
val =val+N pri
nt(l
count)
my f
il
e.cl
ose()
else(A
:)1
(B)2
(C)3
(D)4
v al=v al-N
pr
int
(val,end="@" 4)
1.deffunc(S):
display(40)k=len(S)
print(
v al)m=""
f
ori
inr
ange(
0,k)
:
a)50@10

5|
KVS–Regi
onal
Off
ice,
JAI
PUR|
Sessi
on2021-
22
i
fS[i]
.i
sl
ower ():
m=m+S[ i]
.upper
() 44.Chooset hecor rectopt ion:
el
ifS[i
].
isdi
git()
: Statement 1: Local Variabl esar eaccessibleonly
m=m+' *' withinaf unct ionorbl ocki nwhi chitisdeclar
ed.
el
ifS[i
].
isupper(
): Statement 2: Gl obal variablesar eaccessibl
eonly
m=m+S[ i]
.l
ower() withinthef unct i
oni nwhi cht heyar edef i
ned.
el
se: a.St at ement 1iscor rectbutSt at
ement 2is
m=m+' @' i
ncor rect
pri
nt(m) b.St at ement 2iscor rectbutSt at
ement 1is
f
unc( '
CSWORKSHOP2021' ) i
ncor rect
A)cs@wor kshop@**** c.Bot hSt atement sar eCor r
ect
B)CSWORKSHOP2021 d.Bot hSt atement sar ei ncorrect
C)cs* workshop*@@@@ 45.Consi dert hebel owcodesni ppet
D)cs* WORKSHOP* @@@@ My fi
le=open( “ class.txt”,
”r”)
Str=My f
il
e.r ead( 12)
Theabov ecodewi llbeequal to:
42.Supposecont entof'My f
il
e.t
xt'i
sA A.f il
e(“class. txt”,
”r”
).read( 12)
mypoem
B.My fil
e(“cl ass. t
xt”,
”r”).
read( 12)
Humpt yDumpt ysatonawal l
C.f il
e(“class. txt”,
”r”
).my file.read(12)
Humpt yDumpt yhadagr eatfal
l
D.my fil
e(“cl ass. txt”
,”r
” )
.read( 12)
Alltheki ng'shorsesandal ltheking'smen
Coul dn'tputHumpt ytogetheragain 46.Assumet hecontentoftextf
il
e,'st
udent
.t
xt'
is:
Poem i sgoodbutdonotl i
ke Rameshi sstudent
Whatwi llbet heout putoft hef ol
lowi
ngcode? Radhai sgir
l
my f
ile=open( "
My fil
e.t
xt"
) KVS
vli
st=l ist("
aei
ouAEI OU") Jai
pur
vc=0 Whatwi ll
bethedatatypeofdata_rec?
x=my fi
le.r
ead() myf i
le=open( "
student.
txt
")
foryi nx: data_rec=my f
il
e.r
eadli
nes()
i
f(yinv l
i
st)
: myf i
le.
close()
vc+=1 A.st ri
ng
pri
nt( v
c) B.list
my f
ile.close() C.t uple
(A)46 D.dictionary
(B)45
(C)41
(D)42 47.Consi
dert
hef
oll
owi
ngdi
rect
oryst
ruct
ure.

43.My f
il
e=open(“class.t
xt”,
”r”
)
Str=Myfi
le.r
ead(12)
Theabov ecodewi llbeequal to:U
(A)fi
le(
“class.
txt”
,”
r”).
read(12)
(B)My f
il
e(“cl
ass.t
xt ”
,”
r”)
.read(12) Suppose root di
rect
ory( School
) and present
worki
ngdirect
oryarethesame.Whatwi l
lbet he
(C)fi
le(
“class.
txt”
,”
r”).
my fil
e.r
ead(12)
absol
utepathofthefi
leAchievement
s.j
pg?
(D)my f
il
e(“cl
ass.t
xt”,
”r”)
.r
ead( 12) a.School
/Achi
evements.
jpg

6|
KVS–Regi
onal
Off
ice,
JAI
PUR|
Sessi
on2021-
22
b.School/Sports/ Achievement s.j
pg D.Noneofabov
e
c.School/Sports/../
Achi evement s.
jpg
d.School/Exami nation/Achi evements.
jpg
48.Youhav egiv enaf ile'stu.t
xt' 49.Wr it
etheout
putoft
hef
oll
owi
ng:
mykvi sbesti nt hewor l
d.iam abestst udent
. a=(23,34,
65,
20,
5)
il
ikecomput er. s=0
Whatwi llbet heout putoft hefoll
owingcode? forii
na:
my f
il
e=open( "stu. t
xt") ifi
%2==0:
s=s+a[i
]
str=my fi
le.
readlines()
pri
nt(s)
pri
nt(st
r)
my f
il
e.cl
ose() A.56
A.readf i
rstli
ne B.93
B.readent i
refile C.94
C.readsecondf ile D.Er
ror

Sect
ion–C
Sect
ionCconsi
stsof06quest
ions,
att
emptany05quest
ions.
abc.wr i
terow([
"NAME" ,
"LOCATION",
"CI ]
TY")
Ashvi
k,ast udentofcl ass12th,islearni
ngCSV record=[]
Fi
leModuleinPy thon.Duringexaminati
on, hehas whileTr ue:
beenassi
gnedani ncompletepyt
honcode( shown Name=i nput(
"EnterName\ n")
bel
ow)t ocr eateaCSV Fi l
e'Stud.
csv'( content Locat i
on=input("
EnterLoc\n")
shownbelow) .Helphimi ncompl eti
ngt hecode City=input(
"EnterCit
y \n"
)
whichcr
eatest hedesir
edCSVFi le.
data=[_____
_ __
_____
_ _
_____
__]
#St at
ement-4
CSVFi
l
e record.append(____
_) #Statement
-
5
ch=input("i
nsertmorerecord(y
/n):
")
NAME,
LOCATI
ON,
CITY i
fch==' n'
:
break
Vi
nay
,Jodhpur
,JDH abc._________
_____(
recor
d)
#Statement -6
Aj
ay,
Jai
pur
,JPR

Smi
th,
Udai
pur
,UDP 50.Identi
fythesui
tabl
ecodef
orbl
ankspacei
n
l
inemar kedasStat
ement-
1.
A.csvfil
e
i
mport_
_____
______
___ #Stat
ement -
1 B.CSV
wi
thopen(
______
_____
___
___
_)ascsv1:#St
atement C.csv
-
2 D.Csv
abc=csv.
____
___
___
_____
___#Stat
ement-
3

7|
KVS–Regi
onal
Off
ice,
JAI
PUR|
Sessi
on2021-
22
B.“
Name”,”
Locati
on”,
”Ci
ty”
C.name,
locat
ion,
cit
y
51.Identifythemissingcodef
orbl
ankspacei
n D.Name,
Locati
on,Ci
ty
l
inemar kedasSt at
ement-2?
A."csv1.
csv "
,"w"
B."Stud.
csv "
,mode="w" 54.Identi
fythesui
tabl
ecodeforbl
ankspacei
n
C."Stud.
csv "
,"r
” theli
nemar kedasStat
ement
-5.
D."csv1.csv"
,"r
” A.data
B.inser
t
52.Chooset hefuncti
onname(wi
thargument
) C.record
thatshoul dbeusedi nthebl
ankspaceofli
ne D.Data
mar kedasSt atement-
3.
A.reader(csv 1) 55.Choose the funct
ion name thatshoul
d be
B.reader(Stud) used i nthe bl
ank space ofl i
ne marked as
C.wr i
ter
(csv 1,del
imit
er=’
,’
) Statement-
6tocreatet
hedesiredCSVFil
e?
D.wr i
ter
(Stud) A.dump( )
B.load()
53.I
denti
fythesui
tabl
ecodef
orbl
ankspacei
n C.wr i
ter
ows()
l
inemarkedasStat
ement-
4 D.wr i
ter
ow()
A.NAME,LOCATI
ON,CITY

0-
O-o-BestofLuck–o-
O-0

8|
KVS–Regi
onal
Off
ice,
JAI
PUR|
Sessi
on2021-
22

You might also like