wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

04. Python Looping Statements Quiz

Total questions: 8

Worksheet time: 4mins

Name
Class
Date
1.

What is a correct statement about the 'for loop' in programming?

a)

It iterates over a sequence

b)

It is used for conditional statements

c)

It can only iterate through lists

d)

It is a type of while loop

2.

Which of the following is NOT a type of loop in Python?

a)

Nested loop

b)

Do-while loop

c)

While loop

d)

For loop

3.

Provide a correct statement about the 'for loop' in the context of programming.

a)

A 'for loop' is used to iterate over a sequence (like a list, tuple, or string).

b)

A 'for loop' can only be used with numeric data types.

c)

A 'for loop' does not allow nested loops.

d)

A 'for loop' is the same as a 'while loop'.

4.

In a for loop, what does the range() function do?

a)

Defines the number of iterations

b)

Initializes the loop variable

c)

Creates a list of values

d)

Sets the loop condition

5.

What is the main function of a 'while loop' in Python?

a)

To execute a block of code as long as a condition is true

b)

To iterate a fixed number of times

c)

To define a function

d)

To handle errors

6.

Which line of code contains the error

a)

1

b)

3

c)

4

d)

No Error

7.

Which loop is more suitable when the number of iterations is not known in advance?

a)

for loop

b)

while loop

c)

range loop

d)

repeat-until loop

8.

What is the effect of the break statement inside a loop

a)

Skips the current iteration and goes to the next.

b)

Immediately ends the entire loop.

c)

Restarts the loop from the beginning.

d)

Pauses the loop temporarily.