wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CodeHS 2.10 While Loops

Total questions: 11

Worksheet time: 6mins

Name
Class
Date
1.

A way to repeat code in your program.

a)

loop

b)

condition

c)

selection

d)

counter

e)

fencepost

2.

What lets us repeat code as long as something is true?

a)

while loop

b)

iteration

c)

edge case

d)

counter

e)

bagels

3.

What is code that you put inside an if statement or while loop?

a)

condition

b)

iteration

c)

immersion

d)

fencepost

e)

counter

4.

What lets us change the flow of the code? (choose three)

a)

control structure

b)

if statement

c)

while loop

d)

sequence

e)

counter

5.

What is a problem in your code that only occurs in extreme situations?

a)

edge case

b)

iteration

c)

counter

d)

while loop

e)

condition

6.

What is the fencepost problem better known as?

a)

off-by-one error

b)

farmer's dilemma

c)

Duff's device

d)

iterative design

e)

counter

7.

What was the last thing Mr. Pavao posted on the #comp-sci-general channel in the Discord server?

a)

a bitmoji

b)

an emoji

c)

a gif

d)

the answers to this quiz

e)

a dad joke

8.

How would you describe a while loop?

a)

Check the condition; if it is true, then run a code block. Otherwise, run a different code block.

b)

Check whether the condition is true; if it is true, then keep repeating until the condition is false.

c)

Run a block of code and then check the condition; if the condition is true, then repeat the block of code.

9.

What kind of program structure is a while loop?

a)

infinite look

b)

iterative

c)

sequential

d)

selection

10.

Why would we use a while loop instead of a for loop?

a)

we don't know how many times we want to run the loop

b)

we know how many times we want to run the loop

c)

It's a structure that is more efficient to code and execute

d)

it's best practicies

11.

Which of these are learning targets in today's lesson?

a)

I can explain the purpose of a while loop

b)

I can create while loops to repeat code while a condition is true

c)

I can use while loops to solve new types of problems

d)

I can avoid writing infinite loops

e)

I can use conditionals to create while loops