2. Topic 2(COLON) Programming Fundamentals in Python
Lesson 2.3: Selection: Making Decisions — Quiz
Test your understanding of lesson 2.3: selection: making decisions with 5 practice questions.
Practice Questions
Question 1
What will be the output of the following Python code snippet if the variable x is set to 10?
pythonif x > 5: print('Greater than 5') else: print('5 or less')
Question 2
In Python, which operator is used to combine two boolean expressions to check if both conditions are true?
Question 3
What will be the output of this code if the variable a is set to 3 and b is set to 2?
pythonif a > b: print('a is greater') elif a < b: print('b is greater') else: print('a and b are equal')
Question 4
Which of the following is true about the 'if-elif-else' structure in Python?
Question 5
What will the following code print when run?
pythonx = True if x: print('It is True') else: print('It is False')
