wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Quiz on For Loops

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the main focus of Challenge 26 - 30 in the lesson?

a)

Variables

b)

For Loop

c)

Conditional Statements

d)

Functions

2.

What is the purpose of a for loop in programming?

a)

To only work with strings

b)

To reduce lines of code and save time

c)

To avoid using loops

d)

To perform different actions on each item

3.

What is the syntax to define a for loop?

a)

for element in array:

b)

for i in list:

c)

for item in sequence:

d)

for x in range(5):

4.

What does a for loop iterate over?

a)

Only lists

b)

A sequence of elements

c)

Only dictionaries

d)

Only strings

5.

What is the importance of maintaining indentation in a for loop?

a)

It makes the code look neat

b)

It increases the speed of execution

c)

It is not important

d)

It helps in avoiding syntax errors

6.

What will be the output of the code: 'numbers = [2, 3, 4, 5] for x in numbers: print(x)'?

a)

2 3 4

b)

2 3 4 5 6

c)

2 3 4 5

d)

3 4 5 6

7.

What is the purpose of using a for loop in Activity 1 Solution?

a)

To calculate the total length

b)

To iterate through a list of whales

c)

To find the maximum value

d)

To count the number of elements

8.

What is the correct way to access 'snake_2' and 'snake_3' in Activity 2 Solution?

a)

snakes[2], snakes[3]

b)

snakes[1], snakes[3]

c)

snakes[1], snakes[2]

d)

snakes[0], snakes[1]

9.

What is the purpose of the Practical Activity 3?

a)

To complete challenges 26 to 30

b)

To write a for loop

c)

To study coding concepts

d)

To log into an account

10.

What is the key point of using a for loop according to the lesson?

a)

To perform different actions on each item

b)

To avoid consistent control flow

c)

To increase code duplication

d)

To reduce lines of code and save time