Python Class 11 Test Gen 002
Python Class 11 Test Gen 002
Date : MM : 22
Answer:
(i) 9 times
(ii) 2 times
(iii) 3 times
(iv) 2 times
5. Find the output of the following code:
Answer:
(i) 8 5
(ii) 0 2
(iii) 20 30
(iv) 66.67 126.67
(v) 4 –10 7
(vi) 8 8 0
6. What will be the output for the following Python statements? [CBSE 2021]
D=("AMIT" : 90, "RESHMA":96, "SUKHBIR":92, "JOHN":95)
print("JOHN" in D, 90 in D, sep = "#")
(a) True#False 1
(b) True#True
(c) False#True
(d) False#False
Answer:
(a)
8. Which of the following is not a valid variable name in Python. Justify reason for
it not being a valid name: [CBSE 2021 (C)]
(a) 5Radius
1
(b) Radius_
(c) _Radius
(d) Radius
Answer:
(a)
10. Write the names of the immutable data objects from the following: [CBSE
2021 (C)]
(a) List
(b) Tuple 1
(c) String
(d) Dictionary
Answer:
(b), (c)
12. Which of the following operators will return either True or false? [CBSE 2023] 1
(i) +=
(ii) !=
(iii) =
(iv) *=
Answer:
(ii) !=
13. Rewrite the following code in python after removing all syntax error(s).
Underline each correction done in the code.
input(‘Enter a word’,W)
if W = ‘Hello’ 1
print(‘Ok’)
else:
print(‘Not Ok’)
Answer:
W=input(‘Enter a word’) / /Error 1
if W == ‘Hello’ : / /Error 2,Error 3
print(‘Ok’)
else : / /Error 4
print(‘Not Ok’)
14. What possible outputs(s) are expected to be displayed on screen at the time
of execution of the program from the following code? Also specify the
maximum values that can be assigned to each of the variables BEGIN and
3
LAST.
Answer:
(ii)
15. Based on the following python code, find out the expected correct output(s) 3
from the options (i) to (iv)
import random
lst=["Red","Blue","Green","Yellow"]
for i in range(5,2,-1):
print(lst[random.randint(1,2)],end="%")
(i) Blue%Green%Green%
(ii) Blue%Red%Green%
(iii) Blue%Green%Yellow%
(iv) Blue%Blue%Red%
Answer:
(i)
16. Based on the following python code, find out the expected correct output(s)
from the options (i) to (iv)
tup=("Red","Blue","Green","Yellow")
for i in range(3):
print(tup[random.randrange(1,4,2)],end="#") 3
(i) Blue#Blue#Yellow#
(ii) Red#Green#Green#
(iii) Blue#Yellow#Green#
(iv) Blue#Green#Yellow#
Answer:
(i)