Bird
0
0

Given this code:

medium📝 Predict Output Q5 of 15
Raspberry Pi - GPIO Basics with Python
Given this code:
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.OUT)
print(GPIO.gpio_function(17))

What is the printed output?
A1 (GPIO.OUT)
B3 (GPIO.I2C)
C0 (GPIO.IN)
DRaises RuntimeError
Step-by-Step Solution
Solution:
  1. Step 1: Setup pin 17 as output in BCM mode

    GPIO.setup(17, GPIO.OUT) sets pin 17 as output.
  2. Step 2: gpio_function returns current mode

    Since pin 17 is output, gpio_function(17) returns 1 (GPIO.OUT).
  3. Final Answer:

    1 (GPIO.OUT) -> Option A
  4. Quick Check:

    Pin set as output = gpio_function returns 1 [OK]
Quick Trick: gpio_function returns 1 for output pins [OK]
Common Mistakes:
  • Expecting input mode (0) after setup
  • Thinking gpio_function raises error without cleanup

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes