update quizzes

This commit is contained in:
Michael Elliot Braun 2016-03-30 13:41:01 -07:00
parent 085af70db3
commit 899183f8f4
11 changed files with 67 additions and 55 deletions

View File

@ -8,7 +8,7 @@ These are the answers to the [die roll quiz](/microbit/lessons/die-roll/quiz).
<br/>
```
```blocks
let roll = Math.random(6)
```
@ -18,9 +18,10 @@ let roll = Math.random(6)
<br/>
```
```blocks
let roll = Math.random(6)
if (roll == 5) {
basic.plotImage(`
basic.showLeds(`
. # . # .
. . . . .
. # . # .
@ -36,9 +37,11 @@ if (roll == 5) {
<br />
```
```blocks
let roll = Math.random(6)
if (roll == 5) {
basic.plotImage(`
basic.showLeds(`
. # . # .
. . . . .
. # . # .
@ -46,7 +49,7 @@ if (roll == 5) {
. # . # .
`)
} else if (roll == 4) {
basic.plotImage(`
basic.showLeds(`
. . . . .
. # . # .
. . # . .
@ -64,9 +67,10 @@ Note: students are only required to write the bottom half of this answer, starti
<br />
```
```blocks
let roll = Math.random(6)
if (roll == 4) {
basic.plotImage(`
basic.showLeds(`
. . . . .
. # . # .
. . # . .
@ -74,7 +78,7 @@ if (roll == 4) {
. . . . .
`)
} else if (roll == 3) {
basic.plotImage(`
basic.showLeds(`
. . . . .
. # . # .
. . . . .
@ -92,9 +96,10 @@ Note: students are only required to write the bottom half of this answer, starti
<br />
```
```blocks
let roll = Math.random(6)
if (roll == 3) {
basic.plotImage(`
basic.showLeds(`
. . . . .
. # . # .
. . . . .
@ -102,7 +107,7 @@ if (roll == 3) {
. . . . .
`)
} else if (roll == 2) {
basic.plotImage(`
basic.showLeds(`
# . . . .
. . . . .
. . # . .

View File

@ -10,7 +10,7 @@ Answers will vary. In general, for loop refers to the code that repeats for a fi
## 2. Consider the following code
```
```blocks
for (let i = 0; i < 4; i++) {
basic.showNumber(i, 150)
}
@ -24,7 +24,7 @@ Let's create a for loop where `0` is the loop's starting value, `i` is the index
## 3. Consider the following code
```
```blocks
for (let i1 = 0; i1 < 6; i1++) {
basic.showNumber(i1, 150)
}

View File

@ -16,7 +16,7 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
## 2. Draw the areas where the LEDs will be lit based on the code below. Explain why you chose to draw those numbers.
```
```blocks
for (let i = 0; i < 4; i++) {
basic.showNumber(i, 150)
}
@ -28,7 +28,7 @@ for (let i = 0; i < 4; i++) {
## 3. Draw the areas where the LEDs will be lit based on the code below. Explain why you chose to draw those numbers.
```
```blocks
for (let i1 = 0; i1 < 6; i1++) {
basic.showNumber(i1, 150)
}

View File

@ -18,13 +18,13 @@ An if statement will conditionally run code depending on whether or not a condit
## 2. Create a Variable called ``x`` and assign it to a random number between 0 and 2.
```
```blocks
let x = Math.random(3)
```
## 3. Write the 'if statement' to check if ``x`` is equal to 2. Inside the 'if statement', display the string "Yes".
```
```blocks
if (x == 2) {
basic.showString("Yes", 150)
}
@ -32,7 +32,8 @@ if (x == 2) {
## 3. Write the 'if statement' to check if ``x`` is equal to 1. Inside the 'if statement', display the string "No."
```
```blocks
let x = Math.random(3)
if (x == 2) {
basic.showString("Yes", 150)
} else if (x == 1) {
@ -42,7 +43,8 @@ if (x == 2) {
## 5. Write the code to display the string "I don't know" if the Variable ``x`` is neither 2 nor 1.
```
```blocks
let x = Math.random(3)
if (x == 2) {
basic.showString("Yes", 150)
} else if (x == 1) {

View File

@ -16,28 +16,33 @@ A function that will run code when the BBC micro:bit screen is facing up and ver
<br/>
## 2. Consider the following directions
## 2. Write the condition that detects when the BBC micro:bit logo is facing up and vertically orientated.
The `logo up` event is raised when...
* the screen is facing up and the board is horizontal
* the screen is facing down and the board is horizontal
* the board is vertical and the logo is facing up
Write the condition that detects when the BBC micro:bit logo is facing up and vertically orientated.
<br/>
```
```blocks
input.onLogoUp(() => {
})
```
<br/>
## 3. Consider the following animation
## 3. Write the code to display a downward pointing arrow when the logo is down.
![](/static/mb/lessons/magic-logo-0.png)
Write the code to display a downward pointing arrow when the logo is down.
<br/>
```
```blocks
input.onLogoDown(() => {
basic.plotImage(`
. . # . .

View File

@ -12,15 +12,11 @@ Use the hints from the [magic logo activity](/microbit/lessons/magic-logo/activi
<br/>
## 2. The `logo up` event is raised when...
## 2. Write the condition that detects when the BBC micro:bit logo is facing up and vertically orientated.
* the screen is facing up and the board is horizontal
* the screen is facing down and the board is horizontal
* the board is vertical and the logo is facing up
## 3. Consider the following animation
## 3. Write the code to display a downward pointing arrow when the BBC micro:bit logo is down.
![](/static/mb/lessons/magic-logo-0.png)
Write the code to display a downward pointing arrow when the BBC micro:bit logo is down.

View File

@ -16,7 +16,7 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
## 2. Draw which LEDs are ON after running this code and the random number returned is 0
```
```blocks
let img = images.createImage(`
. . . . . # # # # # . . . . #
. # # # . # . . . # # # . # .
@ -36,7 +36,7 @@ img.showImage(offset)
## 3. Draw which LEDs are ON after running this code with an offset of 5. This would occur if the random number returned is 1.
```
```blocks
let img_ = images.createImage(`
. . . . . # # # # # . . . . #
. # # # . # . . . # # # . # .
@ -56,7 +56,7 @@ img.showImage(offset)
## 4. Draw which LEDs are ON after running this code with an offset of 10. This would occur if the random number returned is 2.
```
```blocks
let img_1 = images.createImage(`
. . . . . # # # # # . . . . #
. # # # . # . . . # # # . # .

View File

@ -14,7 +14,7 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
<br/>
```
```blocks
let randomArrow = Math.random(4)
```
@ -24,7 +24,7 @@ let randomArrow = Math.random(4)
<br/>
```
```blocks
if (randomArrow == 1) {
basic.plotImage(`
. . # . .
@ -42,7 +42,7 @@ if (randomArrow == 1) {
<br />
```
```blocks
if (randomArrow == 2) {
basic.plotImage(`
. . # . .

View File

@ -10,7 +10,7 @@ Answers will vary. In general, for loop refers to the code that repeats for a fi
## 2. Consider the following code
```
```blocks
for (let i = 0; i < 5; i++) {
for (let j = 0; j < 5; j++) {
led.plot(i, j)
@ -30,7 +30,7 @@ This code turns on specific LED. Plot turns on the specified LED on the LED scre
## 3. Consider the following code
```
```blocks
for (let i1 = 0; i1 < 3; i1++) {
for (let j1 = 0; j1 < 3; j1++) {
led.plot(i1, j1)
@ -50,7 +50,7 @@ This code turns on specific LED. Plot turns on the specified LED on the LED scre
## 4. Consider the following code
```
```blocks
for (let i2 = 0; i2 < 2; i2++) {
for (let j2 = 0; j2 < 2; j2++) {
led.plot(i2, j2)

View File

@ -14,7 +14,7 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
## 2. Draw which LEDs are ON after running this code
```
```blocks
for (let i = 0; i < 5; i++) {
for (let j = 0; j < 5; j++) {
led.plot(i, j)
@ -26,7 +26,7 @@ for (let i = 0; i < 5; i++) {
## 3. Draw which LEDs are ON after running this code
```
```blocks
for (let i1 = 0; i1 < 3; i1++) {
for (let j1 = 0; j1 < 3; j1++) {
led.plot(i1, j1)
@ -38,7 +38,7 @@ for (let i1 = 0; i1 < 3; i1++) {
## 4. Draw which LEDs are ON after running this code
```
```blocks
for (let i2 = 0; i2 < 2; i2++) {
for (let j2 = 0; j2 < 2; j2++) {
led.plot(i2, j2)

View File

@ -6,13 +6,14 @@ This is the answer key for the [truth or dare quiz](/microbit/lessons/truth-or-d
## 1. Write the code that will randomly return 0 through 3 and stores the value inside a local variable called 'random'.
```
```blocks
let random = Math.random(4)
```
## 2. Write an if statement that will display the message "TRUTH" on the BBC micro:bit if the local variable 'random' equals 0.
```
```blocks
let random = Math.random(4)
if (random == 0) {
basic.showString("TRUTH", 150)
}
@ -26,13 +27,16 @@ DARE
![](/static/mb/lessons/truth-or-dare-0.png)
```
basic.plotImage(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
```blocks
input.onButtonPressed(Button.A, () => {
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
})
```