pxt-calliope/docs/reference/js/lessons/flipping-bird/quiz.md

61 lines
1.3 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# flipping bird quiz
2016-04-02 01:22:47 +02:00
use modulo with a conditional.
2016-03-26 00:47:20 +01:00
## Name
## Directions
Use this activity document to guide your work in the [flipping bird tutorial](/microbit/lessons/flipping-bird/tutorial).
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. What does "modulo" mean in math?
## 2. Consider the following directions
If the rectangle below represents the BBC micro:bit, shade in the LEDs that show the value being stored into the **global variable**, `count`.
```
count = 1
```
![](/static/mb/empty-microbit.png)
<br/>
<br/>
## 3. Consider the following code
If the rectangle below represents the BBC micro:bit, shade in the LEDs that show the value being stored into the **global variable**, `count`. Explain why that particular area is shaded.
```
count = 1
count_ = count_ + 2
```
![](/static/mb/empty-microbit.png)
<br/>
<br/>
## 4. Consider the following directions
Modulo (Mod) tells us what the remainder of a division is. For example, `15 mod 4 is 3` since 15 divided by 4 has a remainder of 3.
```
count = 12
count = math.mod(count, 5)
```
If the rectangle below represents the BBC micro:bit, shade in the LEDs that show the value being stored into the **global variable**, `count`. Explain why that particular area is shaded.
![](/static/mb/empty-microbit.png)
<br/>
<br/>