pxt-calliope/docs/lessons/strobe-light/quiz.md

51 lines
952 B
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# strobe light quiz
2016-04-02 01:22:47 +02:00
Learn how to create a blinking LED script with a for loop.
2016-03-26 00:47:20 +01:00
## Name
## Directions
2016-03-31 01:10:27 +02:00
Use this activity document to guide your work in the [strobe light tutorial](/microbit/lessons/strobe-light/activity)
2016-03-26 00:47:20 +01:00
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
2016-03-30 22:41:01 +02:00
```blocks
2016-03-26 00:47:20 +01:00
for (let i = 0; i < 5; i++) {
for (let j = 0; j < 5; j++) {
led.plot(i, j)
}
}
```
![](/static/mb/empty-microbit.png)
## 3. Draw which LEDs are ON after running this code
2016-03-30 22:41:01 +02:00
```blocks
2016-03-26 00:47:20 +01:00
for (let i1 = 0; i1 < 3; i1++) {
for (let j1 = 0; j1 < 3; j1++) {
led.plot(i1, j1)
}
}
```
![](/static/mb/empty-microbit.png)
## 4. Draw which LEDs are ON after running this code
2016-03-30 22:41:01 +02:00
```blocks
2016-03-26 00:47:20 +01:00
for (let i2 = 0; i2 < 2; i2++) {
for (let j2 = 0; j2 < 2; j2++) {
led.plot(i2, j2)
}
}
```
![](/static/mb/empty-microbit.png)