Quiz Control Flow

Python Quiz : Python Control Flow – 03

Python Quiz for Control Flow

Welcome to the “Python Quiz for Control Flow”! Mastering control flow structures is a pivotal step in one’s journey to become a proficient Python programmer. This quiz is designed to test your understanding of if-else logic, conditional statements, loops, and other control flow mechanisms in Python. Whether you’re a beginner looking to solidify your foundational knowledge or seeking a quick refresher, this quiz is tailored to challenge and reinforce your grasp on these essential constructs.

Prepare for the quiz: control flow methods

0%
5

Python Control Flow – 03

Level: Beginner

1 / 10

1. What is the output of the following code?

x = 'B'
match x:
  case 'A':
    print('Aye')
  case 'B':
    print('Bee')
  case _:
    print('Other')

2 / 10

2. What is the output of the following code?

x = 'C'
match x:
  case 'A':
    print('Aye')
  case 'B':
    print('Bee')
  case _:
    print('Other')

3 / 10

3. What is the output of the following code?

for i in range(0, 10, 2):
  print(i)

4 / 10

4. What is the output of the following code?

for i in [1, 2, 3]:
  print(i)

5 / 10

5. What is the output of the following code?

x = 3
match x:
  case 1:
    print('One')
  case 2:
    print('Two')
  case _:
    print('Other')```

6 / 10

6. What is the output of the following code?

x = 'A'
match x:
  case 'B':
    print('Bee')
  case 'A':
    print('Aye')

7 / 10

7. What is the output of the following code?

for i in 'abc': print(i)

8 / 10

8. What is the output of the following code?

x = 2
match x:
  case 1:
    print('One')
  case _:
    print('Other')```

9 / 10

9. What is the output of the following code?

for i in range(3, 6):
  print(i)

10 / 10

10. What is the output of the following code?

x = 1
match x:
  case 1:
print('One')

Your score is

0%