0% found this document useful (0 votes)
123 views7 pages

Summative Assessment Answers - Physical Computing - Y9

Assessments

Uploaded by

p.klimenkova09
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
123 views7 pages

Summative Assessment Answers - Physical Computing - Y9

Assessments

Uploaded by

p.klimenkova09
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Year 9 – Physical computing

Summative assessment answers

Summative assessment: Answers


Task 1 .

Q1 Name one output device that is built into the micro:bit.

Ans: The display (5x5 LED matrix)

Q2 Name at least two input devices that are built into the micro:bit.

Ans: Accelerometer
Buttons
Light sensor
Temperature sensor
Compass

Q3 You would like to build a micro:bit project that provides audio feedback to the
user, e.g. a beep or a short tune. Which of the following sentences is true?
A. It is not possible to generate audio output with the micro:bit.
B. It is possible to generate audio output with the micro:bit, by connecting
speakers to the built-in audio port.
C. It is possible to generate audio output with the micro:bit, by connecting
speakers to the GPIO pins.

Ans: C

Q4 Which sensor, built into the micro:bit, would be used in order to detect, ‘gestures’
such as shaking or titling?
A. Radio antenna
B. Accelerometer
C. Magnetometer

Ans: B

Task 2 .

Page 1 Last updated: 01-06-21


Year 9 – Physical computing
Summative assessment answers

Figure 1: Control the LED.

Q5 In Figure 1, the LED is supposed to be controlled (turned on or off) using pin 0. The
arrow shows that one of the crocodile clips has not been connected to a pin.
Which pin should it be connected to?
A. Power (3V)
B. Ground (GND)

Ans: B

Q6 In Figure 1, you are supposed to use pin 0 to control the LED (turn it on or off).
Which piece of code would you use to turn the LED on, assuming the wiring is
correct?

A. pin0 = 1

B. pin0.read_digital() == 1

C. pin0.write_digital(1)

Ans: C

Task 3 .

Page 2 Last updated: 01-06-21


Year 9 – Physical computing
Summative assessment answers

Figure 2: Detect a signal.

Q7 In Figure 2, pin 0 is to be used to detect if a connection is made between the two


jumper wires. The arrow indicates that one of the crocodile clips is not connected
to a pin. Which pin should it be connected to?
A. Power (3V)
B. Ground (GND)

Ans: A

Q8 In Figure 2, pin 0 is to be used to detect if a connection is made between the two


jumper wires. Which piece of code would you use to check if the wires are
connected, assuming the wiring is correct?

A. pin0 == 1

B. pin0.read_digital() == 1

C. pin0.write_digital(1)

D. pin0.is_touched()

Ans: B

Page 3 Last updated: 01-06-21


Year 9 – Physical computing
Summative assessment answers

Task 4 .
Program 1

1 from microbit import *


2 state = 0
3 while True:
4 if button_a.was_pressed():
5 state = 1 - state
6 display.show(state)
7 display.show(">")

Q9 When Program 1 is executed, what will the user see on the micro:bit display after
button A has been pressed once?

Ans: 1 will be displayed

Q10 When Program 1 is executed, what will the user see on the micro:bit display after
button A has been pressed twice?

Ans: 0 will be displayed

Q11 When will line 7 of Program 1 be executed?


A. Line 7 will never be executed.
B. Line 7 will be executed once, after button A has been pressed twice.
C. Line 7 will be executed every time button A is pressed.

D. Line 7 will be executed constantly, i.e. in every round of the while loop.

Ans: A

Task 5 .
Program 2

Page 4 Last updated: 01-06-21


Year 9 – Physical computing
Summative assessment answers

1 from microbit import *


2 import radio
3 radio.on()
4 start = running_time()
5 message = radio.receive()
6 while message != "ping":
7 message = radio.receive()
8 end = running_time()
9 elapsed = .

Q12 Fill in the gap in line 9 of Program 2 above, so that the value of the elapsed
variable is the (approximate) number of seconds between the time that line 4
was executed and the time that line 8 was executed.

Note: The running_time function returns the number of milliseconds


(thousandths of a second) since the micro:bit was switched on or restarted.

Ans: elapsed = (end - start) / 1000

Q13 Describe in one short sentence the purpose of lines 5 to 7 in Program 2 above.

Ans: The program waits, constantly checking for messages, until a “ping” message is received.

Task 6 .
You are asked to create a program for the micro:bit that:
● Starts by lighting up a single
pixel in the top left-hand
corner of the 5⨉5 LED matrix.

Page 5 Last updated: 01-06-21


Year 9 – Physical computing
Summative assessment answers

● Whenever button B is pressed,


the pixel that is currently lit up
is turned off, and the one to its
right is lit up.

● If the pixel that is currently lit


up is already at the end of the
current row, then the next
pixel to light up should be the
first pixel in the next row.

These are the program statements you can use, provided in no particular order.

from microbit import *


display.set_pixel(x, y, 0)
display.set_pixel(x, y, 9)
if button_b.was_pressed():
if x > 4:
x = 0
x = x + 1
y = 0
y = y + 1
while True:

Note: The set_pixel(x,y,b) method of the display sets the pixel at


coordinates x, y to brightness b. The x and y coordinates range from 0 to 4
(inclusive), starting from the top-left corner. The brightness b ranges from 0 to 9
(inclusive).

Q14 Rearrange the statements and use indentation where necessary, so that the
resulting program works as specified. You can use statements more than once.

Ans: 1 from microbit import *


2 x = 0 # x: column
3 y = 0 # y: row
4 while True:
5 display.set_pixel(x, y, 9)

Page 6 Last updated: 01-06-21


Year 9 – Physical computing
Summative assessment answers

6 if button_b.was_pressed():
7 display.set_pixel(x, y, 0) # pixel off
8 x = x + 1 # go right
9 if x > 4:
10 y = y + 1 # next row
11 x = 0 # reset col

Q15 Select one of the statements below to replace the while True statement, so that
the program terminates when button B is pressed and the currently illuminated
pixel is at the bottom right-hand corner of the LED matrix.

A. while x <= 4:

B. while y <= 4:

C. while not True:

Ans: B

Resources are updated regularly - the latest version is available at: the-cc.io/curriculum.

This resource is licensed by the Raspberry Pi Foundation under a Creative Commons At


tribution-NonCommercial-ShareAlike 4.0 International license. To view a copy of this
license, visit, see creativecommons.org/licenses/by-nc-sa/4.0/.

Page 7 Last updated: 01-06-21

You might also like