Bird
0
0
Raspberry Piprogramming~10 mins

Enabling serial on Raspberry Pi - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to enable the serial interface by editing the configuration file.

Raspberry Pi
sudo raspi-config nonint do_serial [1]
Drag options to blanks, or click blank then click option'
A1
Benable
C0
Ddisable
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 disables the serial interface instead of enabling it.
Typing 'enable' or 'disable' instead of 1 or 0 causes the command to fail.
2fill in blank
medium

Complete the command to edit the boot configuration file to enable UART.

Raspberry Pi
sudo nano /boot/config.txt
Add the line: enable_uart=[1]
Drag options to blanks, or click blank then click option'
Afalse
Btrue
C0
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 disables UART instead of enabling it.
Using 'true' or 'false' is not recognized in this config file.
3fill in blank
hard

Fix the error in the command to disable the serial console on Raspberry Pi.

Raspberry Pi
sudo systemctl [1] serial-getty@ttyAMA0.service
Drag options to blanks, or click blank then click option'
Astop
Bstart
Cenable
Drestart
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start' or 'enable' keeps the serial console active.
Restarting the service does not disable it.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps device names to their baud rates, only for devices with baud rate greater than 9600.

Raspberry Pi
baud_rates = {device: rate for device, rate in devices.items() if rate [1] [2]
Drag options to blanks, or click blank then click option'
A>
B9600
C<
D115200
Attempts:
3 left
💡 Hint
Common Mistakes
Using less than operator filters the wrong devices.
Using 115200 as threshold filters too many devices.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that converts device names to uppercase, keeps their baud rates, and filters only devices with baud rate less than 115200.

Raspberry Pi
filtered = { [1]: [2] for [3], rate in devices.items() if rate < 115200 }
Drag options to blanks, or click blank then click option'
Adevice.upper()
Brate
Cdevice
Ddevices
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'devices' instead of 'device' in the loop variable.
Not converting device names to uppercase.