0
0
Raspberry Piprogramming~20 mins

What is Raspberry Pi - Practice Questions & Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Raspberry Pi Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is the primary purpose of a Raspberry Pi?

Choose the best description of what a Raspberry Pi is mainly used for.

AA high-end gaming console designed for playing the latest video games.
BA small, affordable computer used for learning programming and electronics projects.
CA smartphone designed for making calls and sending messages.
DA cloud server used for hosting large websites and applications.
Attempts:
2 left
💡 Hint

Think about a device that helps beginners learn coding and build simple projects.

Predict Output
intermediate
2:00remaining
What will this Python code print on a Raspberry Pi?

Assuming you run this Python code on a Raspberry Pi, what will be the output?

Raspberry Pi
import platform
print(platform.machine())
Ai386
Bx86_64
Carmv7l
Dmips
Attempts:
2 left
💡 Hint

Raspberry Pi uses an ARM processor architecture.

🔧 Debug
advanced
2:00remaining
Why does this Raspberry Pi GPIO code raise an error?

Look at this Python code snippet for controlling a Raspberry Pi GPIO pin. Why does it raise an error?

Raspberry Pi
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(18, GPIO.OUT)
GPIO.output(18, True)
APin 18 is invalid in BOARD mode; it should be a pin number from 1 to 40.
BGPIO.setmode must be called after GPIO.setup.
CGPIO.output requires a string pin name, not an integer.
DThe code is correct and will not raise an error.
Attempts:
2 left
💡 Hint

BOARD mode uses physical pin numbers, not BCM GPIO numbers.

📝 Syntax
advanced
2:00remaining
Which option correctly initializes SPI communication on Raspberry Pi in Python?

Choose the correct Python code snippet to initialize SPI communication using the spidev library on a Raspberry Pi.

A
import spidev
spi = spidev.SpiDev()
spi.open(0, 0)
spi.max_speed_hz = 50000
B
import spidev
spi = spidev.SpiDev()
spi.open(1, 0)
C
import spidev
spi = spidev.SpiDev
spi.open(0, 0)
D
import spidev
spi = spidev.SpiDev()
spi.open(0, 0)
Attempts:
2 left
💡 Hint

Check for correct class name casing and method calls.

🚀 Application
expert
2:00remaining
How many GPIO pins are available for general use on a Raspberry Pi 4 Model B?

Consider the Raspberry Pi 4 Model B's 40-pin header. How many pins can you use as general-purpose input/output (GPIO) pins?

A17 pins
B28 pins
C40 pins
D26 pins
Attempts:
2 left
💡 Hint

Not all 40 pins are GPIO; some are power, ground, or special function pins.