Year 7 · Quiz 3

For loops

10 multiple-choice questions on for, range, running totals, and loops with if. Matches Part 6 of the Year 7 tutorial.

Predict output Fill blanks Find errors
Predict the output

Question 1

Which numbers does range(4) produce?

Choose one answer
Predict the output

Question 2

How many times is Hi printed?

for i in range(3, 8):
    print("Hi")
Choose one answer
Predict the output

Question 3

for i in range(1, 4):
    print(i * 10)
Choose one answer
Fill in the blank

Question 4

To print numbers from 1 to 20 inclusive, use:

for number in range(1, ___):
Choose one answer
Predict the output

Question 5

What does this print at the end?

total = 0
for n in range(2, 9, 2):
    total = total + n
print(total)
Choose one answer
Find the error

Question 6

What is wrong?

for i in range(5)
print("Hello")
Choose one answer
Fill in the blank

Question 7

For a countdown 5, 4, 3, 2, 1 complete:

for n in range(5, 0, ___):
Choose one answer
Predict the output

Question 8

for number in range(1, 4):
    if number % 2 == 0:
        print(number, "even")
    else:
        print(number, "odd")
Choose one answer
Fill in the blank

Question 9

To add numbers from 1 to a user limit inclusive:

for n in range(1, limit + ___):
Choose one answer
Predict / FizzBuzz idea

Question 10

For number 15, which condition should be checked first?

Choose one answer

Previous: Quiz 2 · Year 7 tutorial · All quizzes