Conditional Statements MCQs | JoinMyTutor

MCQs on Python conditional examples.

Conditional Examples MCQs test knowledge of decision-making constructs in Python, including if, elif, else, and nested conditions. This set focuses on writing correct logic, understanding truthy and falsy values, and avoiding common mistakes. Practicing these MCQs helps learners strengthen their ability to implement precise and efficient control flow in Python programs, laying a strong foundation for advanced programming concepts.}

Conditional Examples MCQs

  1. What is output of: if 5>3: print("Yes")?
    • A. Yes
    • B. No
    • C. Error
    • D. None

    Answer: A — Condition is true so prints Yes.

  2. Which keyword is used for else-if ladder?
    • A. elseif
    • B. elif
    • C. else if
    • D. elsif

    Answer: B — elif is used in Python.

  3. What is output: if False: print(1) else: print(0)?
    • A. 1
    • B. 0
    • C. True
    • D. False

    Answer: B — False branch executes.

  4. Which operator is used in condition equality?
    • A. =
    • B. ==
    • C. ===
    • D. !=

    Answer: B — == checks equality.

  5. What will be printed: if "": print("Empty") else: print("Not")?
    • A. Empty
    • B. Not
    • C. Error
    • D. None

    Answer: B — Empty string is false.

  6. Which evaluates True only if both are True?
    • A. or
    • B. and
    • C. xor
    • D. not

    Answer: B — and operator.

  7. Which operator returns True if only one condition is True?
    • A. or
    • B. xor
    • C. not
    • D. and

    Answer: A — or returns True if either is true.

  8. Which operator inverts boolean?
    • A. !
    • B. not
    • C. ~
    • D. invert

    Answer: B — not operator.

  9. What is output: x=10; if x%2==0: print("Even")?
    • A. Odd
    • B. Even
    • C. Error
    • D. None

    Answer: B — 10%2==0 so Even.

  10. Which is ternary operator syntax?
    • A. if cond: x else y
    • B. x if cond else y
    • C. cond ? x : y
    • D. ternary()

    Answer: B — Python uses x if cond else y.

  11. Which evaluates to False?
    • A. 0
    • B. []
    • C. ""
    • D. All of these

    Answer: D — All are falsy.

  12. Which keyword is used for multiple conditions?
    • A. switch
    • B. elif
    • C. match
    • D. select

    Answer: B — elif allows multiple checks.

  13. What is output: if None: print(1) else: print(2)?
    • A. 1
    • B. 2
    • C. None
    • D. Error

    Answer: B — None is falsy so prints 2.

  14. Which executes if all if and elif fail?
    • A. else
    • B. finally
    • C. default
    • D. except

    Answer: A — else is used.

  15. What is output: if 0: print("Yes") else: print("No")?
    • A. Yes
    • B. No
    • C. Error
    • D. None

    Answer: B — 0 is falsy so No.

  16. Which operator checks inequality?
    • A. !=
    • B. <>
    • C. not=
    • D. ne

    Answer: A — != is inequality operator.

  17. Which keyword is used with match-case from Python 3.10?
    • A. switch
    • B. case
    • C. match
    • D. select

    Answer: C — match keyword is used.

  18. What is output: if []: print(1) else: print(0)?
    • A. 1
    • B. 0
    • C. Error
    • D. None

    Answer: B — Empty list is falsy.

  19. Which is correct syntax for nested conditionals?
    • A. if x: if y: ...
    • B. if (x,y): ...
    • C. if x,y: ...
    • D. if: if: ...

    Answer: A — if can be nested.

  20. What is output: if True and False: print(1) else: print(2)?
    • A. 1
    • B. 2
    • C. True
    • D. False

    Answer: B — True and False → False.

💡 Tips & Common Mistakes

Remember to review concepts carefully. Fill in custom tips for conditional-examples here.

📅 Last Updated: November 20, 2026

Vinod Kumar avatar

Vinod Kumar

Senior Full-Stack Instructor

Python & JavaScript Tutor at JoinMyTutor

Vinod teaches practical Python and JavaScript—ranging from basics to advanced web apps—with a focus on clear mental models, code readability, and interview preparation. He authors both the Python and JavaScript tracks on JoinMyTutor.

#Python #Flask #Pandas #JavaScript #Node.js #React #ES6+ #Async/Await #DOM Manipulation
banner