
GCSE AQA FOR & WHILE loop exam questions
Quiz by Javeed Khaliq
Feel free to use or edit a copy
includes Teacher and Student dashboards
Measure skillsfrom any curriculum
Measure skills
from any curriculum
Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
With a free account, teachers can
- edit the questions
- save a copy for later
- start a class game
- automatically assign follow-up activities based on students’ scores
- assign as homework
- share a link with colleagues
- print as a bubble sheet
10 questions
Show answers
- Q1What will be the output of the following code? ```python count = 0 while count < 3: print(count) count += 1 ```0 11 2 30 1 20 1 2 330s
- Q2Which 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
- Q3What will be the result of the following code snippet? ```python for i in range(3): print(i * 2) ```1 2 30 1 20 2 42 4 630s
- Q4What will be printed when the following while loop runs? ```python num = 1 while num <= 5: print(num) num += 1 ```2 3 4 51 2 3 4 51 2 3 41 2 3 4 5 630s
- Q5What 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
- Q6In 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, 51, 2, 3, 4, 50, 1, 2, 3, 40, 1, 2, 330s
- Q7What will be the output of the following code? ```python count = 0 for i in range(3): count += i print(count) ```326030s
- Q8What will happen when the following code is executed? ```python n = 5 while n > 0: print(n) n -= 1 ```04 3 2 15 4 3 2 15 4 3 2 1 030s
- Q9Given the following loop, what will be the final value of 'total'? ```python total = 0 for number in range(1, 4): total += number ```563430s
- Q10What will be the output of this for loop? ```python for i in range(2, 10, 2): print(i) ```2 4 6 82 4 62 4 6 8 101 3 5 730s