From 899183f8f4666d1bf146308ac7666589294f8a7d Mon Sep 17 00:00:00 2001 From: Michael Elliot Braun Date: Wed, 30 Mar 2016 13:41:01 -0700 Subject: [PATCH] update quizzes --- docs/lessons/die-roll/quiz-answers.md | 29 +++++++++++++--------- docs/lessons/looper/quiz-answers.md | 4 +-- docs/lessons/looper/quiz.md | 4 +-- docs/lessons/magic-8/quiz-answers.md | 10 +++++--- docs/lessons/magic-logo/quiz-answers.md | 17 ++++++++----- docs/lessons/magic-logo/quiz.md | 10 +++----- docs/lessons/rock-paper-scissors/quiz.md | 6 ++--- docs/lessons/spinner/quiz-answers.md | 6 ++--- docs/lessons/strobe-light/quiz-answers.md | 6 ++--- docs/lessons/strobe-light/quiz.md | 6 ++--- docs/lessons/truth-or-dare/quiz-answers.md | 24 ++++++++++-------- 11 files changed, 67 insertions(+), 55 deletions(-) diff --git a/docs/lessons/die-roll/quiz-answers.md b/docs/lessons/die-roll/quiz-answers.md index c13aac55..b94306eb 100644 --- a/docs/lessons/die-roll/quiz-answers.md +++ b/docs/lessons/die-roll/quiz-answers.md @@ -8,7 +8,7 @@ These are the answers to the [die roll quiz](/microbit/lessons/die-roll/quiz).
-``` +```blocks let roll = Math.random(6) ``` @@ -18,9 +18,10 @@ let roll = Math.random(6)
-``` +```blocks +let roll = Math.random(6) if (roll == 5) { - basic.plotImage(` + basic.showLeds(` . # . # . . . . . . . # . # . @@ -36,9 +37,11 @@ if (roll == 5) {
-``` +```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
-``` +```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
-``` +```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(` # . . . . . . . . . . . # . . diff --git a/docs/lessons/looper/quiz-answers.md b/docs/lessons/looper/quiz-answers.md index 60d928bf..9cfb1983 100644 --- a/docs/lessons/looper/quiz-answers.md +++ b/docs/lessons/looper/quiz-answers.md @@ -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) } diff --git a/docs/lessons/looper/quiz.md b/docs/lessons/looper/quiz.md index 61663a60..8cbe593e 100644 --- a/docs/lessons/looper/quiz.md +++ b/docs/lessons/looper/quiz.md @@ -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) } diff --git a/docs/lessons/magic-8/quiz-answers.md b/docs/lessons/magic-8/quiz-answers.md index 9503cc01..60628125 100644 --- a/docs/lessons/magic-8/quiz-answers.md +++ b/docs/lessons/magic-8/quiz-answers.md @@ -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) { diff --git a/docs/lessons/magic-logo/quiz-answers.md b/docs/lessons/magic-logo/quiz-answers.md index 1202ff32..4aac9fa7 100644 --- a/docs/lessons/magic-logo/quiz-answers.md +++ b/docs/lessons/magic-logo/quiz-answers.md @@ -16,28 +16,33 @@ A function that will run code when the BBC micro:bit screen is facing up and ver
-## 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.
-``` +```blocks input.onLogoUp(() => { }) ```
-## 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. +
-``` +```blocks input.onLogoDown(() => { basic.plotImage(` . . # . . diff --git a/docs/lessons/magic-logo/quiz.md b/docs/lessons/magic-logo/quiz.md index f777c325..7e13ec55 100644 --- a/docs/lessons/magic-logo/quiz.md +++ b/docs/lessons/magic-logo/quiz.md @@ -12,15 +12,11 @@ Use the hints from the [magic logo activity](/microbit/lessons/magic-logo/activi
-## 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. + diff --git a/docs/lessons/rock-paper-scissors/quiz.md b/docs/lessons/rock-paper-scissors/quiz.md index 84947f7c..2841da06 100644 --- a/docs/lessons/rock-paper-scissors/quiz.md +++ b/docs/lessons/rock-paper-scissors/quiz.md @@ -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(` . . . . . # # # # # . . . . # . # # # . # . . . # # # . # . diff --git a/docs/lessons/spinner/quiz-answers.md b/docs/lessons/spinner/quiz-answers.md index 327ae2d9..1e09edc4 100644 --- a/docs/lessons/spinner/quiz-answers.md +++ b/docs/lessons/spinner/quiz-answers.md @@ -14,7 +14,7 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
-``` +```blocks let randomArrow = Math.random(4) ``` @@ -24,7 +24,7 @@ let randomArrow = Math.random(4)
-``` +```blocks if (randomArrow == 1) { basic.plotImage(` . . # . . @@ -42,7 +42,7 @@ if (randomArrow == 1) {
-``` +```blocks if (randomArrow == 2) { basic.plotImage(` . . # . . diff --git a/docs/lessons/strobe-light/quiz-answers.md b/docs/lessons/strobe-light/quiz-answers.md index b6bb6fc5..3977fb1d 100644 --- a/docs/lessons/strobe-light/quiz-answers.md +++ b/docs/lessons/strobe-light/quiz-answers.md @@ -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) diff --git a/docs/lessons/strobe-light/quiz.md b/docs/lessons/strobe-light/quiz.md index e9257efa..90c82b35 100644 --- a/docs/lessons/strobe-light/quiz.md +++ b/docs/lessons/strobe-light/quiz.md @@ -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) diff --git a/docs/lessons/truth-or-dare/quiz-answers.md b/docs/lessons/truth-or-dare/quiz-answers.md index 346d89cb..3c692eee 100644 --- a/docs/lessons/truth-or-dare/quiz-answers.md +++ b/docs/lessons/truth-or-dare/quiz-answers.md @@ -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(` + . . # . . + . # # # . + # # # # # + . . # . . + . . # . . + `) +}) + ```