Conditional Statements Questions and Answers

Take Exam

Python Programming - Conditional Statements Questions with Answers help understand how decisions are made in code. These Python Conditional Statements Questions are vital for RRB, TCS, and SSC exams focusing on logical flow

Conditional Statements

Showing 10 of 25 questions

21. What will be the output of: x = None; if x is None: print("None") else: print("Not None")

  • None
  • Not None
  • Error
  • False
Show Answer Report

22. Which of these is the ternary operator in Python?

  • condition ? value1 : value2
  • if condition then value1 else value2
  • value1 if condition else value2
  • condition if value1 else value2
Show Answer Report

23. What is the result of: if 1: print("One")

  • One
  • No output
  • Error
  • 1
Show Answer Report

24. Which method is preferred for checking if a string is empty?

  • if s == ""
  • if len(s) == 0
  • if not s
  • All are equivalent
Show Answer Report

25. What will be the output of: x = 7; if x % 2 == 0: print("Even") else: print("Odd")

  • Even
  • Odd
  • 7
  • No output
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test