4. Topic 4(COLON) Programming Fundamentals

Lesson 4.4: Selection And Iteration — Quiz

Test your understanding of lesson 4.4: selection and iteration with 5 practice questions.

Read the lesson first

Practice Questions

Question 1

What is the output of the following Python code snippet?

python
x = 10 if x > 5: print('Greater') else: print('Smaller')

Question 2

Consider the following code snippet. What will be the final value of the variable count after execution?

python
count = 0 for i in range(5): count += 1

Question 3

What will the following code print if the value of num is $7$?

python
num = 7 if num % 2 == 0: print('Even') elif num % 2 == 1: print('Odd')

Question 4

What will the following Python code do?

python
x = 3 if x < 3: print('Less') elif x == 3: print('Equal') else: print('Greater')

Question 5

Which of the following expressions evaluates to true when $a = 5$ and $b = 10$?

python
if a < b: print('True')