wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Loop type quiz- Form

Total questions: 24

Worksheet time: 12mins

Name
Class
Date
1.

for x in range(2, 8):

print(x)

a)

for loop with range

b)

for loop in a loop

c)

for loop with char

d)

for loop with x

2.

for num in range(10, 0, -2):

print(num)

a)

for loop using while

b)

for loop with range

c)

for loop with numbers

d)

for loop in a loop

3.

for i in range(5):

print("Try #", i)

a)

for loop with numbers

b)

for loop with i

c)

for loop with range

d)

for loop with try

4.

for char in "tiger":

print(char)

a)

for loop using num

b)

for loop in a loop

c)

for loop with char

d)

for loop with a string

5.

word = "banana"

for letter in word:

print(letter.upper())

a)

for loop with a variable

b)

for loop using .upper

c)

for loop with a string

d)

for loop with banana

6.

for c in "loop":

if c != "o":

print(c)

a)

for loop

b)

for loop with a string

c)

for loop using not

d)

for loop using char

7.

items = ["apple", "banana", "carrot"]

for item in items:

print(item)

a)

for loop with list

b)

for loop with no list

c)

for loop with fruit

d)

for loop using items

8.

for student in ["Amy", "Ben", "Cam"]:

print("Hi", student)

a)

for loop using brackets

b)

for loop using print

c)

For loop with a list

d)

for loop using strings

9.

primes = [2, 3, 5, 7]

for p in primes:

print(p * p)

a)

for loops using loops

b)

for loops using math

c)

for loops using list

d)

for loops using brackets

10.

x = 5

while x > 0:

print(x)

x -= 1

a)

while loop using x

b)

while loop using math

c)

while loop

d)

while loop using conditional

11.

lives = 3

while lives:

print("Keep going!")

lives -= 1

a)

while loop using forever

b)

while loop using conditional

c)

while loops using characters

d)

while loop using numbers

12.

num = 0

while num < 3:

print("Number:", num)

num += 1

a)

while loops using characters

b)

while loops using letters

c)

while loops using math

d)

while loop using conditional

13.

while True:

print("Loading...")

a)

while using quotes

b)

while using forever loop

c)

while using conditionals

d)

while using characters

14.

while True:

command = input()

if command == "stop":

break

a)

while using break

b)

while using stop

c)

while using infinite loop

d)

while using conditional

15.

while True:

print("Beep!")

a)

while using infinite loop

b)

while using BEEP

c)

while using characters

d)

while while

16.

for i in range(10):

if i == 4:

break

print(i)

a)

for loop using numbers

b)

for loop using only a range

c)

while loop with a break

d)

for loop with a break

17.

x = 0

while True:

if x > 3:

break

print(x)

x += 1

a)

for loop with no break

b)

while loop with a break

c)

for loop with a break

d)

while and for loop break dancing

18.

for letter in "hello":

if letter == "l":

break

print(letter)

a)

for loop with a break

b)

for loop with and if statement

c)

for loop with letter

d)

for loop with a string

19.

for i in range(5):

if i == 2:

continue

print(i)

a)

for loop with range and numbers

b)

for loop with numbers

c)

for loop that is forever

d)

for loop with continue

20.

x = 0

while x < 4:

x += 1

if x == 3:

continue

print(x)

a)

for loop with operators

b)

for loop while adding numbers

c)

for loop with continue

d)

for loop with math

21.

for char in "looping":

if char == "o":

continue

print(char)

a)

for loop with strings

b)

for loop with letters

c)

for loop by the foot

d)

for loop with continue

22.

for row in range(2):

for col in range(3):

print(row, col)

a)

for loops using numbers

b)

for loops using letters

c)

nested loops

d)

for loops using a table

23.

for i in range(2):

for j in range(i, 3):

print(i + j)

a)

for loop using letters

b)

nested loops

c)

for loops using i and j

d)

for loop with numbers

24.

for letter in "hi":

for num in range(3):

print(letter, num)

a)

nested loop

b)

while loop using range

c)

for loop using range

d)

for loop using letters and numbers