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

1. Which keyword is used to start an if statement in Python?

  • when
  • if
  • else
  • condition
Show Answer Report

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:
Show Answer Report

3. Which keyword is used for alternative conditions in an if statement?

  • elseif
  • else if
  • elif
  • otherwise
Show Answer Report

4. What will be the output of: x = 5; if x > 3: print("Hello")

  • Hello
  • No output
  • Error
  • True
Show Answer Report

5. Which operator is used for logical AND in Python?

  • &&
  • AND
  • and
  • &
Show Answer Report

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
Show Answer Report

7. Which of these is a valid conditional expression?

  • if x = 5:
  • if x == 5:
  • if x equals 5:
  • if x === 5:
Show Answer Report

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
Show Answer Report

9. Which operator is used for logical OR in Python?

  • ||
  • OR
  • or
  • |
Show Answer Report

10. What is the result of: if not False: print("True")

  • True
  • False
  • Error
  • No output
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test