Conditional MCQ
Conditional MCQ
a) if a>=2 :
b) if (a >= 2)
c) if (a => 22)
d) if a >= 22
a) if-elif statement
b. for statement
c. if -else statement
d. if statement
if True:
print(1001)
else:
print(2002)
a) 1001
b. true
c.2002
d. false
If 4+5==10:
print(“TRUE”)
else:
print(“false”)
print (“True”)
a. False
True
b. True
True
c. false
d. none
Q.6 What keyword would you use to add an alternative condition to an if statement?
a. else if
b. elseif
c. elif
x=3
print(“ok”)
else:
print(“no output”)
a . ok
b. okok
c. no output
d. none of above
x,y=2,4
if(x+y= =10):
print(“true”)
else:
print(“false”)
a. true
b .false
c. no output
d. none
if a <= 0:
b = b +1
else:
a=a+1
print (“W”)
elif a > 0:
print(“X”)
if b > 0:
print(“Y”)
else:
print(“Z”)
What letters will be printed if the user enters -1 for a and -1 for b?
a) Only W
b. Only X
c. Only Y
d. Only Z
Q.11 If the user inputs : 2<ENTER>, what does the following code snippet print?
x = float(input())
if(x==1):
print(“Yes”)
print(“Maybe”)
else:
print (“No”)
a.Yes
b.No
c.Maybe
d.Nothing is printed
str1=”hello”
c=0
for x in str1:
if(x!=”l”):
c=c+1
else:
pass
print(c)
a) 2
b. 0
c. 4
d. 3
x=3
if x == 0:
elif x == 3:
else :
pass
a) Am I here?
b. Or here?
d.Or here ?
Or over here?
a) If else if
b..if
c. For ;
d.for
a. Block
b.loop
c.indentation
d.{}
Show Answer
Q.18 An ……………… statement has less number of conditional checks than two
successive ifs.
a) If else if
b. if elif
c. if-else
d. none
Show Answer
a) else
b. break
c. continue
d. none
a) continue
b) exit
c. breake
d. break
Q.21 The ……….. operator tests if a given value is contained in a sequence or not.
a) In:
b) in
c. not in
d. none
a) pass
b. none
c. null
Q.23 The break and continue statements, together are called …………….statement.
a) Jump
b. goto
c. compound
d. none
a) in, not in
b. true , false
c.=,==
d. none
a) flow of data
b. barchart
c. flow chart
d. none
a) A>B or A<C
c . A>Band C
d. A>B or C
d) none
a.1
b.2 ,3
c.3
d.4
Q31 A loop block in python starts with a –
a) ; (semicolon)
b) , (comma)
c) : (colon)
d) # (hash)