NEW
Font size
Worksheets04. Python Looping Statements Quiz
Total questions: 8
Worksheet time: 4mins
What is a correct statement about the 'for loop' in programming?
It iterates over a sequence
It is used for conditional statements
It can only iterate through lists
It is a type of while loop
Which of the following is NOT a type of loop in Python?
Nested loop
Do-while loop
While loop
For loop
Provide a correct statement about the 'for loop' in the context of programming.
A 'for loop' is used to iterate over a sequence (like a list, tuple, or string).
A 'for loop' can only be used with numeric data types.
A 'for loop' does not allow nested loops.
A 'for loop' is the same as a 'while loop'.
In a for loop, what does the range() function do?
Defines the number of iterations
Initializes the loop variable
Creates a list of values
Sets the loop condition
What is the main function of a 'while loop' in Python?
To execute a block of code as long as a condition is true
To iterate a fixed number of times
To define a function
To handle errors
Which line of code contains the error
1
3
4
No Error
Which loop is more suitable when the number of iterations is not known in advance?
for loop
while loop
range loop
repeat-until loop
What is the effect of the break statement inside a loop
Skips the current iteration and goes to the next.
Immediately ends the entire loop.
Restarts the loop from the beginning.
Pauses the loop temporarily.
