Cs Annual Pyq
Cs Annual Pyq
of printed pages : 11
ANNUAL EXAMINATION 2023-2024
Time :3 hours ) [Max. Marks :60
Class - XI
Computer Science (083)
General Instructions:
Section -A
P.T.O.
Trusted EAspirants
(2 )
a) per%marks b) for (3 )
While
d) 5.
true Given the following
2. What is/are the correct way to add
dictionaries -
dict_student ("rno" :"53", "name":
an
of a list in Python? element to the end dict_marks =("Accts": 87, "English": 65)Rajveer Singh)
a) list.add(element) Which statement(s) will append the
in dict_student? contents of dict_marks
b) list.append(element) a)
c)
d)
list.insert(element,-1)
list.extend(elernent)
b) didictct_marstudentksS.updatdict_marks
+ e(dict_student)
) dict_ student.update(dict_marks)
d)
3. What will be theoutput of -
6.
dict_student.extend(dict_marks)
What will be the output of the
Str = "HappyNewYear" following code?
L= ['purple , orange', 'green',
'yllow']
print(Str[3:5),join([Str[7:10], Str(-1].upper) ]) print(len(L)/2*len(L0)
4. Which of the following staterment(s) would give an error 7. Which of the following operator cannot be used
with string
during the executionof the following code? data type?
a +
b) in
R= ('pno': 52, 'pname': "Virat', 'expert': c)
('Badrminton', Tennis'], 'score':(77, 44) d) /
print(R) #Staternent 1 8. Considera tuple tupl = (10, 15, 25,'and', 30). ldentify
R['expert'||0]='Cricket' #Statement 2 the statement that will result in an error.
R['score'|0]=50 #Staterment 3
P.T.O.
R[Virat']='Virat Kohli #Statenent 4
ste
(4)
outcome(s) executed
(7)
17. What are
the possible
specilythe maximum and
Irom the (0) ES#NE#IO# (i) LENO#ON#
following code? Also
values that can be
assigned to variable NUM minimum (0) NSENLO# (iv) ECNB#1S#
12 What are the possible outcomels) executed irom the 20. What will be the output of the following code -
following code? Also specify the maximumand the x,y=15,10
minimum values that can be assigned to variable A
def Max(z-5):
import randorn as r global x;global y
String='CBSEONLINE' 2 if x>y and y>z :
A=r.randrarnge(0,4) y+=11; z-+=1; return x+5
B=9 elif x>z:
while String[B]!=L': E= y+=5; return y
print(StringlB| + StringlA] +#Tend =") else:
A=A+1 Z+=5; return z
B= B-1 P.T.O.
(8)
22. How
(9) 36-441550-241
z=Max) rmany
tines will 20 34
printbc,y,z, sep=") the output of the codetrhe loop be eneutes? Also giveebe 44
x=Maxly) %, y = 2, 50
printx,y,z, sep=)
while (x <= 10) :
the following code X+=1
21. What willbe the output of
y -=X+1
defStrFuncname):
Str=
X+=2 SD-3+4
print (x,y)
while True :
printtnameal,a)
if namela].islower):
Section -C
Str+=namela].upper 23. Write only one statement for
elif namelal. isupper): each in python to -
if (a%2) : a) convert the first character of string SEN to
upper
Str+=namela-1] case.
dhApPy'NEw'yeAr"2024]) P.T.O.
10 )
24. Write a function Phone Bill(calls) where calls
\s
argument which recelves no of calls made by a customeran For example
The function teturns the telephone bill of a If the list state
contairns
based on the following criteria Customer then after shifting the list ["MP"UP"WB"AP","HP)
will contain
For the first 100 calls the minimum bill
amount is [UP"WB AP"HPMP1
Rs 100
For the next40 calls Rs. 0.40 per call will be 27. Write a user defined function
extra
charged that takes the dictionary, yellowdeletedata(yellow_pages)
_pages as argument in
For the noxt 60 callsRs. 0.50 per call will be Python and deletes data of those persons whose
charged less than 5 characters from name is
xtra yellow_pages. Structure of
For the calls beyond 200 Rs. 0.60 per call wll be yellow_pages - (phoneno: [name,city])
charged extra 28. Write a user defined function
wordlen(sen) that takes a
sentence as argument and returns tuple containing length
25 Writea function INDEX LIST(L), where L is thelist of of each word of the
sentence as element.
cemets passed as argument to the function. The function
replaces allNon-Zero Elements of Lwith corresponding
index nos and returns count of elements
replaced.
26. Write a user defined function
Rotate(state) where state
is an argument It shifts the elerments
towards left. The
elernent at second position is shifted to the first
the elerrent at third position is position,
shited to the second
position and so on The elerment at the first position is
shifted to the last position