Conditional Statements Questions and Answers
Practice ModeShowing 10 of 25 questions
Q21
What will be the output of: x = None; if x is None: print("None") else: print("Not None")
Answer: Option A
Explanation: The "is" operator checks for identity with None.
Q22
Which of these is the ternary operator in Python?
Answer: Option C
Explanation: Python uses "value_if_true if condition else value_if_false" for ternary operations.
Q23
What is the result of: if 1: print("One")
Answer: Option A
Explanation: In Python, non-zero integers are truthy.
Q24
Which method is preferred for checking if a string is empty?
Answer: Option C
Explanation: Using "not" with the string is the most Pythonic way to check for emptiness.
Q25
What will be the output of: x = 7; if x % 2 == 0: print("Even") else: print("Odd")
Answer: Option B
Explanation: 7 divided by 2 has remainder 1, so it is odd.