Quiz Complete, well Done!
Control flow
What is the output of the following code?
i = 4
while i < 10:
print(i)
if i == 7:
break
i += 1
A
loop is an example of indefinite iteration.
What happens if the condition of a while loop is initially false?
What is the output of the following code?
i = 10
while i > 0:
print(i)
i -= 2
What is the purpose of the 'break' statement in programming?
How do you exit an infinite loop?
Conditional loop
Break statement
Loop
A for loop is an example of
iteration where the number of iterations is known in advance.
In the context of the EdExcel Computer Science iGCSE course, where is the break statement used?
What happens if the condition of a while loop is never true?
Which programming construct is commonly used with the 'continue' statement?
What happens when a 'continue' statement is executed in a loop?
What is the purpose of a while loop?
In which direction does the control flow transfer when a 'break' statement is encountered?
For loop
The condition of a while loop is checked before each
.
What is the output of the following code?
i = 0
while i < 5:
i += 1
if i == 3:
continue
print(i)