If Else in Python MCQs Exercise I


Ques 1 If Else


What is the output of the following Python Code?

li=[11,12,13]
if li[0]^li[0]:
    print("True")
else:
    print("False")

  a) True
  b) False
  c) Error
  d) None of these.


b is the correct option





Ques 2 If Else


What is the output of the following Python Code?

li=[11,12,13]
if print(li[0]^li[0]):
    print("True")
else:
    print("False")

  a) 0
True
  b) 0
False
  c) 1
True
  d) 1
False


b is the correct option





Ques 3 If Else


What is the output of the following Python Code?

p=1
if p==1:
    p*=2
if p==((p**2)/(p*p)):
    print(p)
else:
    print(p+1)

  a) 2
  b) 3
  c) 4
  d) 5


b is the correct option





Ques 4 If Else


What is the output of the following Python Code?

p=1
q=2
if(p!=q) or (print("Hello",endl=" ")):
    print("scoder")
else:
    print("hello")

  a) Hello scoder
  b) hello
  c) scoder
  d) Hello hello


c is the correct option