Thursday, 12 March 2020

MCQs based on Python if else set 1

MCQs based on Python if else




Question 1. If the Boolean expression of if statement evaluates to ________, then the block of code inside the if statement will be ignored.
A. True
B. False
C. both True and False
D. none of these

Question 2. Predict output of the following python program.
a, b, c = 5, 1, 15

if (a < b) and (a < c):
  print("A is minimum")
elif (b < a) and (b < c):
  print("B is minimum")
else:
  print("C is minimum")
A. A is minimum
B. B is minimum
C. C is minimum
D. none of these

Question 3. Predict output of following python code:
if(4-6):
   print("Android")
else:
   print("Linux")


A. Android
B. Linux
C. Error
D. none of these

Question 4. What will be the output of the following python program?

    if False:
       print ("AAA")
    elif True:
       print ("BBB")
    else:
       print ("CCC")

A. AAA
B. BBB
C. CCC
D. none of these

Question 5. What will be the output of the following python program?


    result = 50
    if(result != 50):
       flag=0
    else:
       flag=1
    if(flag==0):
       print("Pass")
    else:
       print("Fail")

A. Pass
B. Fail
C. Syntax Error
D. none of these



Score out of 5 =

Score in percentage =

Check Your Answer Here






No comments:

Post a Comment