PYTHON Control Flow MCQs

  1. Which of the following is used for conditional branching in Python?
    a) if
    b) switch
    c) case
    d) goto
    View Answer

    Correct answer: A — if

  2. What will be printed?
    1 x = 5
    2 if x > 3:
    3 print("Eduinq")
    a) Eduinq
    b) 5
    c) Error
    d) Nothing
    View Answer

    Correct answer: A — Eduinq

  3. Which of the following is used for looping in Python?
    a) for
    b) while
    c) Both A and B
    d) loop
    View Answer

    Correct answer: C — Both A and B

  4. What is the output of print(2 < 3 and 4 > 5)?
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: B — False

  5. Which of the following is used to skip current iteration in a loop?
    a) break
    b) continue
    c) pass
    d) skip
    View Answer

    Correct answer: B — continue

  6. What will be printed?
    1 for i in range(3):
    2 print(i)
    a) 0 1 2
    b) 1 2 3
    c) 0 1 2 3
    d) Error
    View Answer

    Correct answer: A — 0 1 2

  7. Which of the following is used to terminate a loop?
    a) stop
    b) exit
    c) break
    d) end
    View Answer

    Correct answer: C — break

  8. What is the output of print(5==5 or 2==3)?
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: A — True

  9. Which of the following is used to execute code when condition is false?
    a) if
    b) else
    c) elif
    d) None
    View Answer

    Correct answer: B — else

  10. What will be printed?
    1 x = 2
    2 if x == 2:
    3 print("Eduinq")
    4 else:
    5 print("Python")
    a) Eduinq
    b) Python
    c) Error
    d) Nothing
    View Answer

    Correct answer: A — Eduinq

  11. Which of the following is used for multiple conditions?
    a) if
    b) else
    c) elif
    d) switch
    View Answer

    Correct answer: C — elif

  12. What is the output of print(not(2 > 3))?
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: A — True

  13. Which of the following is used to define infinite loop?
    a) while True
    b) for True
    c) loop()
    d) repeat()
    View Answer

    Correct answer: A — while True

  14. What will be printed?
    1 for i in range(1,4):
    2 print(i)
    a) 1 2 3
    b) 0 1 2
    c) 1 2 3 4
    d) Error
    View Answer

    Correct answer: A — 1 2 3

  15. Which of the following is used to execute code when condition is true?
    a) if
    b) else
    c) elif
    d) None
    View Answer

    Correct answer: A — if

  16. What is the output of print(2 > 3 or 4 < 5)?
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: A — True

  17. Which of the following is used to define empty loop body?
    a) break
    b) continue
    c) pass
    d) skip
    View Answer

    Correct answer: C — pass

  18. What will be printed?
    1 x = 10
    2 while x > 7:
    3 print("Eduinq")
    4 x -= 1
    a) Eduinq Eduinq Eduinq
    b) Eduinq Eduinq
    c) Eduinq Eduinq Eduinq Eduinq
    d) Infinite loop
    View Answer

    Correct answer: C — Eduinq Eduinq Eduinq Eduinq

  19. Which of the following is used to combine conditions?
    a) and
    b) or
    c) not
    d) Both A and B
    View Answer

    Correct answer: D — Both A and B

  20. What is the output of print(2 < 3 and not(4 < 5))?
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: B — False

  21. Which of the following is used to iterate over sequence?
    a) for
    b) while
    c) loop
    d) repeat
    View Answer

    Correct answer: A — for

  22. What will be printed?
    1 for i in "Eduinq":
    2 print(i, end="")
    a) Eduinq
    b) E d u i n q
    c) Error
    d) Nothing
    View Answer

    Correct answer: A — Eduinq

  23. Which of the following is used to exit from nested loops?
    a) break
    b) continue
    c) pass
    d) return
    View Answer

    Correct answer: A — break

  24. What is the output of print(2==2 and 3!=4)?
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: A — True

  25. Which of the following is used to check multiple conditions sequentially?
    a) if-else ladder
    b) switch
    c) case
    d) goto
    View Answer

    Correct answer: A — if-else ladder

  26. What will be printed?
    1 x = 0
    2 while x < 3:
    3 print(x)
    4 x += 1
    a) 0 1 2
    b) 1 2 3
    c) 0 1 2 3
    d) Error
    View Answer

    Correct answer: A — 0 1 2

  27. Which of the following is used to check condition inside loop?
    a) if
    b) else
    c) elif
    d) None
    View Answer

    Correct answer: A — if

  28. What is the output of print(2 < 3 and 4 > 5 or 6 == 6)?
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: A — True

  29. Which of the following is used to define conditional expression?
    a) if-else
    b) ternary operator
    c) Both A and B
    d) None
    View Answer

    Correct answer: C — Both A and B

  30. What will be printed?
    1 x = 5
    2 if x % 2 == 0:
    3 print("Even")
    4 else:
    5 print("Odd")
    a) Even
    b) Odd
    c) Error
    d) Nothing
    View Answer

    Correct answer: B — Odd

  31. Which of the following is used to check condition in loop header?
    a) for
    b) while
    c) Both A and B
    d) None
    View Answer

    Correct answer: C — Both A and B

  32. What is the output of print(2 > 3 or 4 > 5)?
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: B — False

  33. Which of the following is used to define conditional block?
    a) if
    b) else
    c) elif
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  34. What will be printed?
    1 for i in range(2,5):
    2 print(i)
    a) 2 3 4
    b) 1 2 3
    c) 2 3 4 5
    d) Error
    View Answer

    Correct answer: A — 2 3 4

  35. Which of the following is used to define loop with condition?
    a) for
    b) while
    c) Both A and B
    d) None
    View Answer

    Correct answer: C — Both A and B

  36. What is the output of print(not(2==2))?
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: B — False

  37. Which of the following is used to define loop with sequence?
    a) for
    b) while
    c) Both A and B
    d) None
    View Answer

    Correct answer: A — for

  38. What will be printed?
    1 x = 3
    2 if x > 5:
    3 print("Eduinq")
    4 else:
    5 print("Python")
    a) Eduinq
    b) Python
    c) Error
    d) Nothing
    View Answer

    Correct answer: B — Python

  39. Which of the following is used to define conditional loop?
    a) for
    b) while
    c) Both A and B
    d) None
    View Answer

    Correct answer: B — while

  40. What will be printed?
    1 x = 0
    2 if x:
    3 print("Eduinq")
    4 else:
    5 print("Python")
    a) Eduinq
    b) Python
    c) Error
    d) Nothing
    View Answer

    Correct answer: B — Python

  41. Which of the following is used to check multiple conditions in one line?
    a) Nested if
    b) Ternary operator
    c) elif ladder
    d) goto
    View Answer

    Correct answer: B — Ternary operator

  42. What is the output of print(2 < 3 < 4)?
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: A — True

  43. Which of the following is used to define conditional loop with exit?
    a) for
    b) while
    c) Both A and B
    d) None
    View Answer

    Correct answer: C — Both A and B

  44. What will be printed?
    1 for i in range(0,5,2):
    2 print(i)
    a) 0 2 4
    b) 1 3 5
    c) 0 1 2 3 4
    d) Error
    View Answer

    Correct answer: A — 0 2 4

  45. Which of the following is used to define conditional branching with multiple options?
    a) if-elif-else
    b) switch
    c) case
    d) goto
    View Answer

    Correct answer: A — if-elif-else

  46. What is the output of print(2==2 and 3==3)?
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: A — True

  47. Which of the following is used to define loop with condition check at start?
    a) for
    b) while
    c) Both A and B
    d) None
    View Answer

    Correct answer: B — while

  48. What will be printed?
    1 for i in range(3):
    2 if i == 1:
    3 continue
    4 print(i)
    a) 0 1 2
    b) 0 2
    c) 1 2
    d) Error
    View Answer

    Correct answer: B — 0 2

  49. Which of the following is used to define conditional block with multiple branches?
    a) if
    b) else
    c) elif
    d) All of the above
    View Answer

    Correct answer: D — All of the above

  50. What is the output of print(2 > 1 and 3 < 4)?
    a) True
    b) False
    c) Error
    d) None
    View Answer

    Correct answer: A — True

Quick Links to Explore