Conditional Statements Questions and Answers
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
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
24. Which method is preferred for checking if a string is empty?
- if s == ""
- if len(s) == 0
- if not s
- All are equivalent
25. What will be the output of: x = 7; if x % 2 == 0: print("Even") else: print("Odd")
- Even
- Odd
- 7
- No output