If Else in Python MCQs Exercise II
Ques 1
If Else
What is the output of the following Python Code?
p=1
q=2
if(p!=q) and (print("Hello")):
print("scoder")
else:
print("hello")
A Hello scoder
B hello
C scoder
D Hello hello
Ques 2
If Else
What is the correct syntax for an if statement in Python?
A if x > y: print(x)
B if (x > y) { print(x) }
C if x > y then print(x)
D if x > y; print(x)
Ques 3
If Else
Can an if statement in Python be used without an else?
A Yes
B No
C Only with elif
D None of these