wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

[AP CSP] FOR & WHILE LOOPS

Total questions: 20

Worksheet time: 40mins

Name
Class
Date
1.

In a Python program, what would be the iteration variable (looping variable) in the FOR LOOP code?

a)

n

b)

num

c)

value

d)

i

2.

In a Python program, what would be the iteration variable (looping variable) in the WHILE LOOP code?

a)

w

b)

y

c)

z

d)

i

3.

In a Python program, what would be the starting value in the FOR LOOP code?

a)

100

b)

10

c)

5

d)

20

4.

In a Python program, what would be the starting value in the FOR LOOP code?

a)

25

b)

4

c)

1

d)

0

5.

In a Python program, what would be the starting value in the WHILE LOOP code?

a)

20

b)

5

c)

2

d)

15

6.

In a Python program, what would be the starting value in the WHILE LOOP code?

a)

50

b)

3

c)

5

d)

10

7.

In a Python program, what would be the starting value in the WHILE LOOP code?

a)

6

b)

1

c)

0

d)

10

8.

In a Python program, what would be the ending value in the WHILE LOOP code?

a)

0

b)

5

c)

2

d)

20

9.

In a Python program, what would be the ending value in the WHILE LOOP code?

a)

5

b)

50

c)

10

d)

3

10.

In a Python program, what would be the increment value for the looping variable in the WHILE LOOP code?

a)

5

b)

3

c)

-5

d)

1

11.

In a Python program, what would be the increment value for the looping variable in the FOR LOOP code?

a)

15

b)

7

c)

10

d)

1

12.

In a Python program, what would be the ending value in the FOR LOOP code?

a)

15

b)

1

c)

10

d)

100

13.

In a Python program, what would be the increment value for the looping variable in the FOR LOOP code?

a)

15

b)

1

c)

3

d)

5

14.

In a Python program, what would be the increment value for the looping variable in the WHILE LOOP code?

a)

30

b)

1

c)

-3

d)

-10

15.

In a Python program, what would be the increment value for the looping variable in the FOR LOOP code?

a)

-100

b)

1

c)

5

d)

-5

16.

In a Python program, how many iterations(loops) will occur for the FOR LOOP code?

a)

1

b)

10

c)

9

d)

8

17.

In a Python program, how many outputs will occur for the snippet of code?

a)

15

b)

3

c)

6

d)

5

18.

In a Python program, how many outputs will occur for the snippet of code?

a)

5

b)

2

c)

8

d)

4

19.
A loop repeated if the condition is true / false
a)
While loop
b)
For loop
c)
Repeat loop
d)
If...else
20.
Loop executed a fixed number of times with a built-in-counter (creating a counter variable is unnecessary).
a)
While loop
b)
For loop
c)
Repeat loop
d)
If...else