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
1. Which keyword is used to start an if statement in Python?
- when
- if
- else
- condition
2. What is the correct syntax for an if statement in Python?
- if (x > y) { }
- if x > y then
- if x > y:
- if x > y then:
3. Which keyword is used for alternative conditions in an if statement?
- elseif
- else if
- elif
- otherwise
4. What will be the output of: x = 5; if x > 3: print("Hello")
- Hello
- No output
- Error
- True
6. What is the purpose of the else clause in an if statement?
- To handle errors
- To execute when if condition is True
- To execute when all conditions are False
- To create a loop
7. Which of these is a valid conditional expression?
- if x = 5:
- if x == 5:
- if x equals 5:
- if x === 5:
8. What will be the output of: x = 2; if x > 5: print("A") elif x > 1: print("B") else: print("C")
- A
- B
- C
- No output
10. What is the result of: if not False: print("True")
- True
- False
- Error
- No output