Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Micro:bit Programming Quiz

Total questions: 38

Worksheet time: 19mins

Name
Class
Date
1.

What does from microbit import * do?

a)

Create a new program

b)

Import functions from Micro:bit

c)

Save the project

d)

Restart Micro:bit

2.

Which command will display a heart image on the Micro:bit screen?

a)

display.show("HEART")

b)

display.show(Image.HEART)

c)

display.show("HEART", 3)

d)

show.display(Image.HEART)

3.

What is the function of the display.scroll("text") method?

a)

Displays a text at the center of the screen

b)

Displays text scrolling across the screen

c)

Displays images

d)

Turns off the screen

4.

What type of loop runs code indefinitely on Micro:bit?

a)

for loop

b)

while True: loop

c)

repeat loop

d)

until loop

5.

Which of these is a valid way to stop the Micro:bit program?

a)

Pressing the reset button

b)

display.clear()

c)

break

d)

stop()

6.

What does button_a.is_pressed() return?

a)

Number

b)

Image

c)

True or False

d)

Text

7.

How do you detect if button A was pressed?

a)

if button_a.is_pressed():

b)

if button_a.was_pressed():

c)

if button_a.is_pushed():

d)

if button_a.on_press():

8.

What does button_b.was_pressed() check?

a)

If button B is being pressed now

b)

If button B was pressed since the last check

c)

If button B is held down

d)

If button A is pressed

9.

To detect whether both button A and B are pressed at the same time, you would use:

a)

if button_a.is_pressed() and button_b.is_pressed():

b)

if button_a.was_pressed() and button_a.was_pressed():

c)

if button_ab.is_pressed():

d)

if button_a.is_pressed() or button_b.is_pressed():

10.

In the game, how do you increase a number when button A is pressed?

a)

number = number + 1

b)

number += 1

c)

number = number++

d)

number = add(number, 1)

11.

What is the purpose of a while True: loop in Python?

a)

To run the code only once

b)

To create an infinite loop

c)

To exit the loop after one run

d)

To repeat the loop a fixed number of times

12.

How do you prevent a while True: loop from running endlessly?

a)

Use a sleep() inside the loop

b)

Use a break condition

c)

Use if statements to exit

d)

All of the above

13.

Which command pauses the program for 1 second?

a)

sleep(1000)

b)

wait(1)

c)

pause(1000)

d)

sleep(1)

14.

How do you stop a while True: loop immediately?

a)

exit()

b)

end()

c)

break

d)

continue

15.

What will happen if there is no sleep() inside a while True: loop?

a)

The Micro:bit will crash

b)

The program will run slower

c)

The program will consume a lot of power

d)

The code will automatically restart

16.

Which Python function generates a random number between 0 and 9?

a)

random.choice(0, 9)

b)

random.randint(0, 9)

c)

random.random(0, 9)

d)

random.get(0, 9)

17.

If you want to generate a random number between 1 and 6 (like a dice), which code should you use?

a)

random.randint(1, 6)

b)

random.choice(1, 6)

c)

random.number(1, 6)

d)

random.range(1, 6)

18.

What is the output of random.randint(5, 10)?

a)

A number from 5 to 10, including 10

b)

A number between 5 and 10, excluding 10

c)

A random float number

d)

An error

19.

What is returned by the function running_time()?

a)

Time since Micro:bit was turned on, in seconds

b)

Time since program started, in milliseconds

c)

Time elapsed from the last press

d)

Time since the last loop ran

20.

What is the correct way to measure elapsed time in milliseconds from when the program started?

a)

start = running_time()

b)

start = running_time(0)

c)

start = time()

d)

start = millis()

21.

If you want to delay code execution for exactly 2 seconds, you should use:

a)

sleep(2000)

b)

delay(2)

c)

wait(2000)

d)

sleep(2)

22.

How would you check how much time has passed since the start of the program?

a)

running_time() - start

b)

elapsed_time()

c)

time_passed()

d)

time()

23.

What function helps you pause the program for a specific amount of time?

a)

stop()

b)

pause()

c)

sleep()

d)

delay()

24.

What is the correct way to create a variable for the player's score?

a)

score = 0

b)

let score = 0

c)

score: 0

d)

score == 0

25.

Which of these is a valid variable name?

a)

score-player

b)

score1

c)

2score

d)

Score!

26.

How would you increase the value of a variable counter by 1?

a)

counter++

b)

counter += 1

c)

counter.add(1)

d)

counter = counter + 1

27.

Which of the following is the correct way to count how many times button A is pressed?

a)

if button_b.was_pressed():
press_count+=1

b)

if button_a.was_pressed():
press_count+=1

c)

if button.a.was_pressed():
press_count+1

d)

if button_a.was_pressed():
press_count=+1

28.

Which line resets the variable score to 0?

a)

score = 0

b)

reset(score)

c)

score.clear()

d)

score(0)

29.

What is the correct syntax to check if score is greater than 10?

a)

if score > 10:

b)

if score > 10 then:

c)

if score > 10 {

d)

if (score > 10)

30.

What will the following code display if light_level = 60? if light_level > 50: display.show(Image.HAPPY) else: display.show(Image.SAD)

a)

Happy image

b)

Sad image

c)

Error

d)

Nothing

31.

What is the result of if x == 5:?

a)

If x is 5, execute code

b)

If x is greater than 5, execute code

c)

If x is less than 5, execute code

d)

If x is not equal to 5, execute code

32.

What will happen if if temperature() > 25: is true?

a)

Executes code inside the block

b)

Executes code outside the block

c)

Nothing happens

d)

Program stops

33.

Which code is correct for checking whether a number is positive?

a)

if number > 0:

b)

if number >= 0:

c)

if number != 0:

d)

if number < 0:

34.

How do you display a smiley face on the Micro:bit screen?

a)

display.show(Image.SMILE)

b)

display.show("SMILE")

c)

display.show(Images.SMILE)

d)

show.display(Image.SMILE)

35.

Which of these will display the text "HELLO" scrolling across the screen?

a)

display.scroll("HELLO")

b)

display.show("HELLO")

c)

show.scroll("HELLO")

d)

scroll.display("HELLO")

36.

What is the function of display.clear()?

a)

Clears all variables

b)

Clears the text on the screen

c)

Clears the program

d)

Clears the timer

37.

Which of these methods can be used to display an image?

a)

display.show("image_name")

b)

display.show(Image.NAME)

c)

display.image("NAME")

d)

display.show(TEXT)

38.

How would you create a heart shape that stays on the screen?

a)

display.show(Image.HEART)

b)

display.scroll(Image.HEART)

c)

display.show("HEART")

d)

display.add(Image.HEART)

Similar Resources on Wayground