pxt-calliope/docs/lessons/strobe-light/quiz.md
2016-06-14 17:28:08 -04:00

943 B

strobe light quiz

Learn how to create a blinking LED script with a for loop.

Name

Directions

Use this activity document to guide your work in the strobe light tutorial

Answer the questions while completing the tutorial. Pay attention to the dialogues!

1. What is a for loop?

2. Draw which LEDs are ON after running this code

for (let i = 0; i < 5; i++) {
    for (let j = 0; j < 5; j++) {
        led.plot(i, j)
    }
}

3. Draw which LEDs are ON after running this code

for (let i1 = 0; i1 < 3; i1++) {
    for (let j1 = 0; j1 < 3; j1++) {
        led.plot(i1, j1)
    }
}

4. Draw which LEDs are ON after running this code

for (let i2 = 0; i2 < 2; i2++) {
    for (let j2 = 0; j2 < 2; j2++) {
        led.plot(i2, j2)
    }
}