wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

[Hall] While Loops

Total questions: 10

Worksheet time: 6mins

Name
Class
Date
1.

Goal = Create a loop that turns as long as i is less than 10.

What should replace ⭐?

a)

>

b)

<

c)

>=

d)

<=

2.

Which is an example of a variable?

a)

counter

b)

"counter"

3.

Goal = Create a loop that increases i by 2 each time.

What should replace ⭐?

a)

i += 2

b)

i ++

c)

i = i + 2

d)

+2

4.

Which is an example of a string?

a)

counter

b)

"counter"

5.

What is a value for ⭐ that would prevent the loop from ever running?

a)

10

b)

0

c)

1

d)

-5

6.

Goal = Create a loop that increases i by 1 each time.

What should replace ⭐?

a)

i += 1

b)

i ++

c)

i + 2

d)

i += 2

7.

What JavaScript code matches this statement:

Their name is Jacob and they are less than 15 years old.

a)

if(name = "Jacob" && age < 15)

b)

if(name == "Jacob" && age < 15)

c)

if(name == "Jacob" || age < 15)

d)

if("name" == "Jacob" && age < 15)

8.

What is a value for ⭐ that would prevent the loop from ever running?

a)

10

b)

15

c)

100

d)

11

9.

What symbol represents the or operator in JavaScript?

a)

OR

b)

or

c)

|

d)

||

10.

Goal = Create a loop that turns as long as i is greater than 10.

What should replace ⭐?

a)

>

b)

<

c)

>=

d)

<=