You are on page 1of 16

REVISION TOUR(MCQ)

1) State True or False – ‘Tuple is one of the datatypes of python having data in key-value pair.”
2) State True or False “Python has a set of keywords that can also be used to declare variables.”
3) Which of the following is not a valid python operator?
a) %
b) in
c) #
d) **
4) What will be the output of the following python expression?
print(2**3**2)
a) 64
b) 256
c) 512
d) 32
5) Observe the given dictionary:
d_std={“Roll_No”:53,”Name”:’Ajay Patel’}
d_marks={“Physics”:84,”Chemistry”:85}
Which of the following statement will combine both dictionaries?
a) d_std + d_marks
b) d_std.merge(d_marks)
c) d_std.add(d_marks)
d) d_std.update(d_marks)
6) What will be the output of the following python dictionary operation?
data = {‘A’:2000, ‘B’:2500, ‘C’:3000, ‘A’:4000}
print(data)
a) {‘A’:2000, ‘B’:2500, ‘C’:3000, ‘A’:4000}
b) {‘A’:2000, ‘B’:2500, ‘C’:3000}
c) {‘A’:4000, ‘B’:2500, ‘C’:3000}
d) It will generate an error
7) What will be the output for the following expression:
not ((False and True or True) and True)
a) True
b) False
c) None
d) Null
8) What will be the output for the following expression:
print(True or not True and False)
Choose one option from the following that will be the correct output after executing the above
python expression.
a) False
b) True
c) or
d) not
9) What will be the output of the given code?
s=’CSTutorial@TutorialAICSIP’
o=s.partition(‘Tutorial’)
print(o[0]+o[2])
a) CSTutorial
b) CSTutorialAICSIP
c) CS@TutorialAICSIP
d) Tutorial@TutorialAICSIP
10) Select the correct output of the following python code:
str=”My program is program for you”
t = str.split(“program”)
print(t)
a) [‘My ‘, ‘ is ‘, ‘ for you’]
b) [‘My ‘, ‘ for you’]
c) [‘My’,’ is’]
d) [‘My’]
11) Which of the following operations on a string will generate an error?
a) “PYTHON”*2
b) “PYTHON” + “10”
c) “PYTHON” + 10
d) “PYTHON” + “PYTHON”
12) Kevin has written the following code:
d={‘EmpID’:1111,’Name’:’Ankit
Mishra’,’PayHeads’:[‘Basic’,’DA’,’TA’],’Salary’:(15123,30254,5700)} #S1
d[‘PayHeads’][2]=’HRA’ #S2
d[‘Salary’][2]=8000 #S3
print(d) #S4
But he is not getting output. Select which of the following statement has errors?
a) S1
b) S2 and S3
c) S3
d) S4
13) What will be the output of following expression in python?
print ( round (100.0 / 4 + (3 + 2.55) , 1 ) )
a) 30.0
b) 30.5
c) 30.6
d) 30.1
Fill in the Blank:
14) The explicit ___________________ of an operand to a specific type is called type casting.
a) Conversion
b) Declaration
c) Calling of Function
d) Function Header
15) Which of the following is not a core data type in Python?
a) Boolean
b) integers
c) strings
d) Class
16) What will the following code do?
dict={"Exam":"SSCE", "Year":2022}
dict.update({"Year”:2023} )
a) It will create a new dictionary dict={” Year”:2023} and an old dictionary will be deleted
b) It will throw an error and the dictionary cannot be updated
c) It will make the content of the dictionary as dict={“Exam”:”SSCE”, “Year”:2023}
d) It will throw an error and dictionary and do nothing
17) What will be the value of the expression :
4+3%5
a) 2
b) 6
c) 0
d) 7
18) Select the correct output of the code:
a= "Year 2022 at All the best"
a = a.split('2')
b = a[0] + ". " + a[1] + ". " + a[3]
print (b)
a) Year . 0. at All the best
b) Year 0. at All the best
c) Year . 022. at All the best
d) Year . 0. at all the best
19) Which of the following statement(s) would give an error after executing the following code?
S="Welcome to class XII" # Statement 1
print(S) # Statement 2
S="Thank you" # Statement 3
S[0]= '@' # Statement 4
S=S+"Thank you" # Statement 5
a) Statement 3
b) Statement 4
c) Statement 5
d) Statement 4 and 5
20) State true or false:
“A dictionary key must be of a data type that is mutable”.
21) What will be the data type of p, if p=(15)?
a) int
b) tuple
c) list
d) set
22) Which of the following is a valid identifier in python?
a) else_if
b) for
c) pass
d) 2count
23) Consider the given expression:
‘5’ or 4 and 10 and ‘bye’
Which of the following will be the correct output if the given expression is evaluated?
a) True
b) False
c)’5’
d)’bye’
24) Select the correct output of the code:
for i in "CS12":
print([i.lower()], end="#")
a) ‘c’#’s’#’1’#’2’#
b) [“cs12#’]
c) [‘c’]#[‘s’]#[‘1’]#[‘2’]#
d) [‘cs12’]#
25) Which of the following Statement(s) would give an error after executing the following code?
d={"A":1, "B": 2, "C":3, "D":4} #Statement 1
sum_keys =0 #Statement 2
for val in d.keys(): #Statement 3
sum_keys=sum_keys+val #Statement 4
print(sum_keys)
a) Statement 2
b) Statement 4
c) Statement 1
d) Statement 3
26) What will the following expression be evaluated to in Python?
print(25//4 +3**1**2*2)
a) 24
b)18
c) 6
d) 12
27) What will be the output of the following expression?
24//6%3 , 24//4//2 , 48//3//4
a) (1,3,4)
b) (0,3,4)
c) (1,12,Error)
d) (1,3,#error)
28) What will the following expression be evaluated to in Python?
print(23 + (5 + 6)**(1 + 1))
(a) 529
(b) 144
(c) 121
(d) 1936
29) Given is a Python string declaration:
message='FirstPreBoardExam@2022-23'
Write the output of: print(message[ : : -3].upper())
'322ADORSF'
30) Write the output of the code given below
d1={'rno':21, 'name':'Rajveer'}
d2={'name':'Sujal', 'age':17,'class':'XII-A'}
d2.update(d1)
print(d2.keys())
31) Predict the output of the following code:
dt=["P",10,"Q",30,"R",50]
t=0
a=""
ad=0
for i in range(1,6,2):
t=t+i
a = a + dt [i-1] + "@"
ad = ad + dt[i]
print (t, ad, a)
32) Predict the output of the given code:
L=[11,22,33,44,55]
Lst=[]
for i in range(len(L)):
if i%2==1:
t=(L[i],L[i]*2)
Lst.append(t)
print(Lst)
33) What will be the output of the following string operation?
str="PYTHON@LANGUAGE"
print(str[2:12:2])
34) Write the output of the following code.
data = [11,int(ord('a')),12,int(ord('b'))]
for x in data:
x = x + 10
print(x,end=' ')

35) Write the output of the following code and the difference between a*3 and (a,a,a)?
a=(1,2,3)
print(a*3)
print(a,a,a)
(1, 2, 3, 1, 2, 3, 1, 2, 3)
(1, 2, 3) (1, 2, 3) (1, 2, 3)
36) Write the output of the following code.
s="ComputerScience23"
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)
37) Given is a Python List declaration: lst1=[39,45,23,15,25,60]
What will be the output of print(Ist1.index(15)+2) 5
38) Write the output ot the code given below:
x=["rahul",5, B",20,30]
x.insert(1,3)
x.insert(3, "akon”)
print(x[2]) 5
39) Predict the output of the python code given below:
st= "python programming"
count=4
while True:
if st=="p":
st=st[2:]
elif st[-2]=="n":
st =st[:4]
else:
count+=1
break
print(st)
print(count)
40) Predict the output:
myvalue=["A", 40, "B", 60, "C", 20]
alpha =0
beta = ""
gama = 0
for i in range(1,6,2):
alpha +=i
beta +=myvalue[i-1]+ "#"
gama +=myvalue[i]
print(alpha, beta, gama)
41) Rewrite the following code in python after removing all syntax error(s). Underline each correction
done in the code.
Num=int(rawinput("Number:"))
sum=0
for i in range(10,Num,3)
sum+=1
if i%2=0:
print(i*2)
else:
print(i*3)
print (Sum)
42) Predict the output of the following python code:
data = [2,4,2,1,2,1,3,3,4,4]
d = {}
for x in data:
if x in d:
d[x]=d[x]+1
else:
d[x]=1
print(d)

43) Vivek has written a code to input a number and check whether it is even or odd number. His code is
having errors. Rewrite the correct code and underline the corrections made.
Def checkNumber(N):
status = N%2
return
#main-code
num=int( input(“ Enter a number to check :))
k=checkNumber(num)
if k = 0:
print(“This is EVEN number”)
else:
print(“This is ODD number”)

44) Predict the output for following code:


def printMe(q,r=2):
p=r+q**3
print(p)
#main-code
a=10
b=5
printMe(a,b)
printMe(r=4,q=2)
45) Predict the output of the following python code:
def foo(s1,s2):
l1=[]
l2=[]
for x in s1:
l1.append(x)
for x in s2:
l2.append(x)
return l1,l2
a,b=foo("FUN",'DAY')
print(a,b)
46) Rewrite the following code in python after removing all the syntax errors. Underline each correction
done in the code.
Function F1():
num1,num2 = 10
While num1 % num2 = 0
num1+=20
num2+=30
Else:
print('hello')
47) Predict the output of the following code fragment:
def Change(P ,Q=30):
P=P+Q
Q=P-Q
print(P,"#",Q)
return(P)
R=150
S=100
R=Change(R,S)
print(R,"#",S)
S=Change(S)
250 # 150
250 # 100
130 # 100
48) Find the invalid identifier from the following:
a) MyName
b) True
c) 2ndName
d) My_Name
49) Given the lists L=[1,3,6,82,5,7,11,92] , write the output of print(L[2:5]).
50) Given a Tuple tup1= (10, 20, 30, 40, 50, 60, 70, 80, 90). What will be the output of print (tup1
[3:7:2])?
a. (40,50,60,70,80)
b. (40,50,60,70)
c. [40,60]
d. (40,60)
51) Which of the following operator cannot be used with string data type?
a. +
b. in
c. *
d. /
52) What is the output of the following code:
T=(100)
print(T*2)
a. Syntax error
b. (200,)
c. 200
d. (100,100)
53) Which statement will merge the contents of both dictionaries?
a. dict_exam.update(dict_result)
b. dict_exam + dict_result
c. dict_exam.add(dict_result)
d. dict_exam.merge(dict_result)
54) Consider the given expression:
not True and False or True True
55) Which of the following will be the correct output if the given expression is evaluated?
(a) True
(b) False
(c) NONE
(d) NULL
56) Select the correct output of the code:
a = "Year 2022 at All the best"
a = a.split('2')
b = a[0] + ". " + a[1] + ". " + a[3]
print (b)
(a) Year . 0. at All the best
(b) Year 0. at All the best
(c) Year . 022. at All the best
(d) Year . 0. at all the best
57) Which of the following statement(s) would give an error after executing the following code?
S="Welcome to class XII" # Statement 1
print(S) # Statement 2
S="Thank you" # Statement 3
S[0]= '@' # Statement 4
S=S+"Thank you" # Statement 5
(a) Statement 3
(b) Statement 4
(c) Statement 5
(d) Statement 4 and 5
58) What will the following expression be evaluated to in Python? print(15.0 / 4 + (8 + 3.0))
(a) 14.75
(b)14.0
(c) 15
(d) 15.5
59) What will be the output of the following code?
tup1 = (1,2,[1,2],3)
tup1[2][1]=3.14
print(tup1)
a. (1,2,[3.14,2],3)
b. (1,2,[1,3.14],3)
c. (1,2,[1,2],3.14)
d. Error Message
60) Which is the correct form of declaration of dictionary?
a. Day={1:’monday’,2:’tuesday’,3:’wednesday’}
b. Day=(1;’monday’,2;’tuesday’,3;’wednesday’)
c. Day=[1:’monday’,2:’tuesday’,3:’wednesday’]
d. Day={1’monday’,2’tuesday’,3’wednesday’]
61) Kunj has declared a variable as follows:
L=[1,45,’hello’,54.6]
Identify L?
a. List
b. Tuple
c. Dictionary
d. Function
62) Write the output of following:
x = "abcdef"
i = "a"
while i in x:
print(i, end = " ")
a. abcdef
b. abcde
c. bcde
d. infinite loop
63) Given is a Python string declaration:
myexam="@@CBSE Examination 2022@@"
Write the output of: print(myexam[::-2])
a. @20 otnmx SC@
b. @@CBSE Examination 2022
c. @2202 noitanimaxE ESBC
d. None of these
64) 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())
a. dict_items([(‘name’, ‘Aman’), (‘age’, 27), (‘address’, ‘Delhi’)])
b. dict_items([(‘name’,’Aman’),(‘age’,26)])
c. dict_items({name:’Aman’,age:27,’address’:’Delhi’})
65) For the given declaration in Python as s=’WELCOME’:
Which of the following will be the correct output of print(S[1::2])?
a) WEL
b) COME
c) WLOE
d) ECM
66) Find and write the output of the following python code :
for Name in ['John', 'Garima','Seema','Karan']:
print(Name)
if Name[0]=='S':
break
else:
print ('Completed!')
print('Weldone!')
a) John
Completed
Garima
Completed
Seema Completed
b) John
Completed!
Garima
Completed!
Seema
Weldone!
c) John Completed!
Garima Completed!
Seema Weldone!
d) Error
67) What will be the output of the following Python code?
S="UVW"
L=[10,20,301]
D={}
N=len (S)
for I in range (N):
D[I] = S[I]
for K,V in D.items ():
print (K,V, sep="*" ,end="")
a) U*10,V*20,W*30,
b) 10*U, 20*v, 30*W,
c) 10,20,30,u*v*w*
d) Error
68) Write a program in python to display the elements of list twice, if it is a number and display the
element terminated with ‘*’ if it is not a number. For example, if the content of list is as follows :
MyList=[‘RAMAN’,’21’,’YOGRAJ’,’3′,’TARA’]
The output should be
RAMAN*
2121
YOGRAJ*
33
TARA*
69) Rewrite the following code in Python after removing all syntax errors. Underline the corrections.
for Name in [Ramesh, Suraj, Priya]
IF Name[0]=’S’:
print(Name)
70) Find the output of the following:
values = [10,20,30,40]
for v in values:
for i in range(1, v%9):
print(i,’*’,end=’’)
print()
71) Find and write the output of the following Python code :
Data = ["P",20,"R",10,"S",30]
Times = 0
Alpha = ""
Add = 0
for C in range(1,6,2):
Times = Times + C
Alpha = Alpha + Data[C-1]+"$"
Add = Add + Data[C]
print (Times,Add,Alpha)
72) Rewrite the following code in python after removing all syntax error(s). Underline each correction
done in the code.
25=Val
for I in the range(0,Val)
if I%2==0:
print I+1
Else:
print I–1
73) Find and write the output of the following python code :
Text1="SSCE 2023"
Text2=" "
I=0
while I<len(Text1):
if Textl[I]>="0" and Textl[I]<="9":
Val = int(Textl[I])
Val = Val + 1
Text2=Text2 + str(Val)
elif Textl[I]>="A" and Textl[I] <="Z":
Text2=Text2 + (Text1[I+1])
else :
Text2=Text2 + "*"
I=I+1
print(Text2)
74) Write the names of any four data types available in Python.
75) Rewrite the following code in python after removing all syntax error(s). Underline each correction
done in the code.
250 = Number
WHILE Number<=1000:
if Number=>750:
print Number
Number=Number+100
else
print Number*2
Number=Number+50
76) Find and write the output of the following python code :
Msg1="WeLcOME"
Msg2="GUeSTs"
Msg3=""
for I in range(0,len(Msg2)+1):
if Msg1[I]>="A" and Msg1[I]<="M":
Msg3=Msg3+Msg1[I]
elif Msg1[I]>="N" and Msg1[I]<="Z":
Msg3=Msg3+Msg2[I]
else:
Msg3=Msg3+"*"
print(Msg3)
77) Which of the following function header is correct?
a. def cal_si(p=100, r, t=2)
b. def cal_si(p=100, r=8, t)
c. def cal_si(p, r=8, t)
d. def cal_si(p, r=8, t=2)
78) Which of the following is the correct way to call a function?
a. my_func()
b. def my_func()
c. return my_func
d. call my_func()
79) What will be the output of the following code?
def my_func(var1=100, var2=200):
var1+=10
var2 = var2 - 10
return var1+var2
print(my_func(50),my_func())
a. 100 200
b. 150 300
c. 250 75
d. 250 300
80) What will be the output of the following code?
value = 50
def display(N):
global value
value = 25
if N%7==0:
value = value + N
else:
value = value - N
print(value, end="#")
display(20)
print(value)
a. 50#50
b. 50#5
c. 50#30
d. 5#50#
81) What will be the output of the following code?
import random
List=["Delhi","Mumbai","Chennai","Kolkata"]
for y in range(4):
x = random.randint(1,3)
print(List[x],end="#")
a. Delhi#Mumbai#Chennai#Kolkata#
b. Mumbai#Chennai#Kolkata#Mumbai#
c. Mumbai# Mumbai #Mumbai # Delhi#
d. Mumbai# Mumbai #Chennai # Mumbai
82) What is the output of the following code snippet?
def ChangeVal(M,N):
for i in range(N):
if M[i]%5 == 0:
M[i]//=5
if M[i]%3 == 0:
M[i]//=3
L = [25,8,75,12]
ChangeVal(L,4)
for i in L:
print(i,end="#")
a) 5#8#15#4#
b) 5#8#5#4#
c) 5#8#15#14#
d) 5#18#15#4#

83) Find the output of the following code:


def convert():
Name="PythoN3.10"
R=""
for x in range(len(Name)):
if Name[x].isupper():
R=R+Name[x].lower()
elif Name[x].islower():
R=R+Name[x].upper()
elif Name[x].isdigit():
R=R+Name[x-1]
else:
R=R+"#"
print(R)
a. pYTHOn##10
b. pYTHOnN#1
c. pYTHOn#.1
d. pYTHOnN#.1
84) What will be the output of the following code?
x=3
def myfunc():
global x
x+=2
print(x, end=' ')
print(x, end=' ')
myfunc()
print(x, end=' ')
a. 3 3 3
b. 3 4 5
c. 3 3 5
d. 3 5 5
85) What will be the output of the following Python code?
def add (num1, num2):
sum = num1 + num2
sum = add(20,30)
print(sum)
a. 50
b. 0
c. Null
d. None
86) Identify the output of the following Python statements:
S =”GoOD MORNING”
print (S.capitalize (),s.title () ,end=”! “)
(a) GOOD MORNING !Good morning
(b) Good Morning!Good morning
(c) Good morning! Good Morning!
(d) God morning Good Morning!
87) What will be the output of the following Python code?
S="WELcOME"
def Change (T) :
T="HELLO"
print (T, end='@')
Change (S)
print (S)
a) WELcOME@ HELLO
b) HELLO@HELLO
c) HELLO@WELcOME
d) WELCOME@WELCOME
88) Identify the correct possible output for the following Python code :
import random
for N in range (2,5,2):
print (random. randrange (1,N) ,end="#")
a) 1#3#5#
b) 2#3#
c) 1#4#
d) 1#3#
89) What are the possible outcome(s) executed from the following code? Also specify the maximum and
minimum values that can be assigned to variable COUNT.
TEXT="CBSEONLINE"
COUNT=random.randint(0,3)
C=9
while TEXT[C]!='L':
print (TEXT[C]+TEXT[COUNT]+'*', end='')
COUNT=COUNT+1
C=C-1
a) EC*NB*IS*
b) NS*IE*LO*
c) ES*NE*IO*
d) LE*NO*ON*
90) What will be the output of the following Python code ?
def FunStr (S):
T=''
for i in S:
if i.isdigit ():
T = T +i
return T
X= "PYTHON 3.9"
Y = FunStr (X)
print (X, Y, sep="*")
a) PYTHON 3.9
b) PYTHON 3.9*3.9
c) PYTHON 3.9*39
d) Error
91) What will be the output of the following Python code?
V=50
def Change (N):
global V
V, 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
92) What is the output of the following Python code ?ff
def ListChange () :
for i in range (len (L)):
if L[i]%2 == 0:
L[i]=L[i]*2
if L[i]%3==0:
L[i]=L[i]*3
else:
L[i]=L[ij*5
L = [2,6,9,10]
ListChange ()
for i in L:
print (i,end="#")
a) 4#12#27#20#
b) 20#36#27#100#
c) 6#18#27#50#
d) Error
93) What will be the output of the following Python code?
V = 25
def Fun (Ch):
V=50
print (V, end=Ch)
V *= 2
print (V, end=Ch)
print (V, end="*")
Fun ("!")
print (V)
a) 25*50! 100 !25
b) 50*100 !100!100
c) 25*50! 100!100
d) Error
94) Predict the output of the Python code given below:
def Diff(N1,N2):
if N1>N2:
return N1-N2
else:
return N2-N1
NUM= [10,23,14,54,32]
for CNT in range (4,0,-1):
A=NUM[CNT]
B=NUM[CNT-1]
print(Diff(A,B),'#', end=' ')
a) 22 # 40 # 9 # 13 #
b) 9 # 22 # 13 # 53 #
c) 9 # -30 # 22 # 22
d) Error
95) Rewrite the following code in python after removing all syntax error(s). Underline each correction
done in the code.
def Sum(Count) #Method to find sum
S=0
for I in Range(1,Count+1):
S+=I
RETURN S
print (Sum[2]) #Function Call
print (Sum[5])
96) Find the output for the following:
def fun(s):
k=len(s)
m=" "
for i in range(0,k):
if(s[i].isupper()):
m=m+s[i].lower()
elif s[i].isalpha():
m=m+s[i].upper()
else:
m=m+'#'
print(m)
fun('BoardExam@2K23')
97) Find and write the output of the following python code :
def Changer(P,Q=10):
P=P/Q
Q=P%Q
print(P,"#",Q)
return P
A=200
B=20
A=Changer(A,B)
print( A,"$",B)
B=Changer(B)
print( A,"$",B)
A=Changer(A)
print (A,"$",B)
98) 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#
99) Find and write the output of the following Python code:
def Display(str):
m=""
for i in range(0,len(str)):
if(str[i].isupper()):
m=m+str[i].lower()
elif str[i].islower():
m=m+str[i].upper()
else:
if i%2==0:
m=m+str[i-1]
else:
m=m+"#"
print(m)
Display('Fun@Python3.0')
100) Write the output of the code given below:
p=5
def sum(q,r=2):
global p
p=r+q**2
print(p, end= '#')
a=10
b=5
sum(a,b)
sum(r=5,q=1)

You might also like