placeholder image to represent content

GCSE AQA FOR & WHILE loop exam questions

Quiz by Javeed Khaliq

Our brand new solo games combine with your quiz, on the same screen

Correct quiz answers unlock more play!

New Quizalize solo game modes
10 questions
Show answers
  • Q1
    What will be the output of the following code? ```python count = 0 while count < 3: print(count) count += 1 ```
    0 1
    1 2 3
    0 1 2
    0 1 2 3
    30s
  • Q2
    Which of the following correctly initializes a for loop that prints the even numbers from 0 to 10?
    for i in range(0, 11, 2):
    for i in range(0, 10):
    for i in range(1, 11, 2):
    for i in range(2, 12, 2):
    30s
  • Q3
    What will be the result of the following code snippet? ```python for i in range(3): print(i * 2) ```
    1 2 3
    0 1 2
    0 2 4
    2 4 6
    30s
  • Q4
    What will be printed when the following while loop runs? ```python num = 1 while num <= 5: print(num) num += 1 ```
    2 3 4 5
    1 2 3 4 5
    1 2 3 4
    1 2 3 4 5 6
    30s
  • Q5
    What is the purpose of the 'break' statement inside a loop?
    It starts the loop over from the beginning.
    It skips the current iteration.
    It immediately exits the loop.
    It pauses the loop for a moment.
    30s
  • Q6
    In a for loop like `for i in range(5):`, what are the values of 'i' during the execution of the loop?
    0, 1, 2, 3, 4, 5
    1, 2, 3, 4, 5
    0, 1, 2, 3, 4
    0, 1, 2, 3
    30s
  • Q7
    What will be the output of the following code? ```python count = 0 for i in range(3): count += i print(count) ```
    3
    2
    6
    0
    30s
  • Q8
    What will happen when the following code is executed? ```python n = 5 while n > 0: print(n) n -= 1 ```
    0
    4 3 2 1
    5 4 3 2 1
    5 4 3 2 1 0
    30s
  • Q9
    Given the following loop, what will be the final value of 'total'? ```python total = 0 for number in range(1, 4): total += number ```
    5
    6
    3
    4
    30s
  • Q10
    What will be the output of this for loop? ```python for i in range(2, 10, 2): print(i) ```
    2 4 6 8
    2 4 6
    2 4 6 8 10
    1 3 5 7
    30s

Teachers give this quiz to your class