AISMV_XII_SOLVED_QB_REVIEW OF XI
AISMV_XII_SOLVED_QB_REVIEW OF XI
AISMV_XII_SOLVED_QB_REVIEW OF XI
CLASS XII
SOLVED QUESTION BANK
REVIEW OF XI
1 mark
1) State True or False: The Python interpreter handles logical errors during code
execution.
Ans False
2) Identify the output of the following code snippet:
text = "PYTHONPROGRAM"
text=text.replace('PY','#')
print(text)
(A) #THONPROGRAM (B) ##THON#ROGRAM
(C) #THON#ROGRAM (D) #YTHON#ROGRAM
Ans) (A)
3) Which of the following expressions evaluates to False?
(A) not(True) and False (B) True or False
(C) not(False and True) (D) True and not(False)
Ans) (A)
4) What is the output of the expression?
country='International'
print(country.split("n"))
(A) ('I', 'ter', 'atio', 'al') (B) ['I', 'ter', 'atio', 'al'] (C) ['I', 'n', 'ter', 'n', 'atio', 'n', 'al'] (D) Error
Ans) (B) ['I', 'ter', 'atio', 'al']
5) What will be the output of the following code snippet?
message= "World Peace"
print(message[-2::-2])
Ans) ce lo
6) What will be the output of the following code?
tuple1 = (1, 2, 3)
tuple2 = tuple1
tuple1 += (4,)
print(tuple1 == tuple2)
(A) True (B) False (C)tuple1 (D)Error
Ans) (B) False
7) If my_dict is a dictionary as defined below, then which of the following
statements will raise an exception?
my_dict = {'apple': 10, 'banana': 20, 'orange': 30}
(A) my_dict.get('orange') (B) print(my_dict['apple', 'banana'])
(C) my_dict['apple']=20 (D) print(str(my_dict))
Ans) (B) print(my_dict['apple', 'banana'])
8) What does the list.remove(x) method do in Python?
(A) Removes the element at index x from the list
(B) Removes the first occurrence of value x from the list
(C)Removes all occurrences of value x from the list
(D)Removes the last occurrence of value x from the list
Ans) (B) Removes the first occurrence of value x from the list
9) State True or False: “In a Python program, if a break statement is given in a
nested loop, it terminates the execution of all loops in one go.”
Ans) False
10) What will be the output of the following statement:
print(3-2**2**3+99/11)
a. 244 b. 244.0 c. -244.0 d. Error
Ans) Option c -244.0
11) Select the correct output of the code:
Ans) PYTHON-is-Fun
12) Which of the following will delete key-value pair for key = “Red” from a dictionary
D1?
a. delete D1("Red") b. del D1["Red"] c. del.D1["Red"] d. D1.del["Red"]
Option b del D1["Red"]
13) Consider the statements given below and then choose the correct output from
the given options:
pride="#G20 Presidency" print(pride[-2:2:-2])
Options: a. ndsr b. ceieP0 c. ceieP d. yndsr
Ans) Option b ceieP0
14) Which of the following statement(s) would give an error during execution of the
following code?
tup = (20,30,40,50,80,79)
print(tup) #Statement 1
print(tup[3]+50) #Statement 2
print(max(tup)) #Statement 3
tup[4]=80 #Statement 4
Options: a. Statement 1 b. Statement 2 c. Statement 3 d. Statement 4
Ans) Option d Statement 4
15) What possible outputs(s) will be obtained when the following code is executed?
Options:
a. RED*
WHITE*
BLACK*
b. WHITE*
BLACK*
c. WHITE* WHITE*
BLACK* BLACK*
d. YELLOW*
WHITE*WHITE*
BLACK* BLACK* BLACK*
Option b
WHITE*
BLACK*
50)
Ans) a
2 mark questions
Ans) DEL@COL@BEI
52) Write the Python statement for each of the following tasks using
BUILT-IN functions/methods only : 1+1=2
(i) To delete an element 10 from the list lst.
(ii) To replace the string "This" with "That" in the string str1.
Ans) lst.remove(10)
Str1=str1.replace(‘This’,’That’)
53) A dictionary dict2 is copied into the dictionary dict1 such that the common key’s
value gets updated. Write the Python commands to do the task and after that empty
the dictionary dict1.
Ans)
dict1.update(dict2)
dict1.clear()
s="India Growing"
n = len(s)
m=""
for i in range (0, n) :
if (s[i] >= 'a' and s[i] <= 'm') :
m = m + s [i].upper()
elif (s[i] >= 'O' and s[i] <= 'z') :
m = m +s [i-1]
elif (s[i].isupper()):
m = m + s[i].lower()
else:
m = m + '@'
print (m)
Ans) iIDIA@gGroIiG
55) a. Given is a Python string declaration: myexam="@@CBSE Examination
2022@@" Write the output of: print(myexam[::-2])
b. Write the output of the code given below:
my_dict = {"name": "Aman", "age": 26}
my_dict['age'] = 27
my_dict['address'] = "Delhi"
print(my_dict.items())
Ans) A) Output: si no
B) dict_values([['Rahul', 95], ['Siya', 90], ['Rajan', 80]])
59) What possible output(s) are expected to be displayed on screen at the time of
execution of the following code ?
Options :(I) Pencil:Book
(II) Pencil:Book
Eraser:Bag
(III) Pen:Book
Bag:Book
(IV) Bag:Eraser
Ans) I and IV
60) Predict the output of the code given below :
text="LearningCS"
L=len(text)
ntext=""
for i in range (0,L):
if text[i].islower():
ntext=ntext+text[i].upper()
elif text [i].isalnum():
ntext=ntext+text[i-1]
else:
ntext=ntext+'&&'
print(ntext)
Ans) SEARNINGgC
61) Predict the output of the code given below:
s="welcome2cs"
n = len(s)
m=""
for i in range(0, n):
if (s[i] >= 'a' and s[i] <= 'm'):
m = m +s[i].upper()
elif (s[i] >= 'n' and s[i] <= 'z'):
m = m +s[i-1]
elif (s[i].isupper()):
m = m + s[i].lower()
else:
m = m +'&'
print(m)
Ans) sELCcME&Cc
62)
Ans) Students.pop(“Nisha”)
print(Message.count(“is”))
63) 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 FROM and TO.
import random
AR=[20,30,40,50,60,70]
FROM=random.randint(1,3)
TO=random.randint(2,4)
for K in range(FROM,TO+1):
print (AR[K],end=”#“)
(i) 10#40#70# (ii) 30#40#50# (iii) 50#60#70# (iv) 40#50#70#
Ans) Max value of From = 3
To=4
ii)
64)
Ans) R*A*C*E*C*A*R*
C#A#R#
R*A*D*A*R*
65)
Ans)
Lst=list(subject)
Lst.pop()