pxt-calliope/docs/reference/js/lessons/rotating-animation/quiz.md
2016-03-25 16:47:20 -07:00

2.2 KiB

rotating animation quiz

Learn how to create a rotating image with a while loop. #image #loop #while #docs

Name

Directions

Use this activity document to guide your work in the rotating animation tutorial.

Answer the questions below while working on or after you finish the tutorial. Pay attention to the dialogs!

1. What is a while loop?

2. Consider the following directions

Write the code to create a global variable called rotating and initialize it to true.

3. Consider the following directions

Write the code to create a while loop that will be executed only if the global variable called rotating is true.

4. Consider the following code

basic.showAnimation(`
# . . . . . . # . . . . . . # . . . . .
. # . . . . . # . . . . . # . . . . . .
. . # . . . . # . . . . # . . # # # # #
. . . # . . . # . . . # . . . . . . . .
. . . . # . . # . . # . . . . . . . . .
`, 400)

If the rectangles below represents a board that is 5 LEDs wide and 5 LEDs tall, place an X approximately where the LED is lighted in the series. Explain why the LED is lighted there.


ANSWER KEY

Directions

Answer the questions below while working on or after you finish the tutorial.

2. Consider the following directions

Write the line of code to create a global variable called rotating and initialize it to true.

rotating = true

3. Consider the following directions

Write the line of code that create a while loop that will be executed only if the global variable called rotating is true.

while (rotating) {
}

4. Consider the following code

basic.showAnimation(`
# . . . . . . # . . . . . . # . . . . .
. # . . . . . # . . . . . # . . . . . .
. . # . . . . # . . . . # . . # # # # #
. . . # . . . # . . . # . . . . . . . .
. . . . # . . # . . # . . . . . . . . .
`, 400)

If the rectangles below represents a board that is 5 LEDs wide and 5 LEDs tall, place an X approximately where the LED is lighted in the series. Explain why the LED is lighted there.