Quiz Complete, well Done!
Do-while loop
Break statement
A do-while loop is an example of a loop with
condition.
Control flow
Infinite loop
When is the 'continue' statement used in programming?
What is the output of the following code?
i = 10
while i > 0:
print(i)
i -= 2
Which keyword is used for infinite loops in Python?
How do you terminate a while loop?
What is the output of the following code?
i = 0
while True:
print(i)
if i == 5:
break
i += 1
What is the purpose of a while loop?
What is the purpose of a while loop?
A for loop is an example of
iteration where the number of iterations is known in advance.
Conditional loop
What is the purpose of the 'break' statement in programming?
In
iteration, the number of iterations is not known in advance.
Which programming language supports the break statement?
What is the purpose of the break statement in programming?
What is the output of the following code?
i = 4
while i < 10:
print(i)
if i == 7:
break
i += 1
The range function is often used in
loops to iterate over a specific sequence of numbers.