Bird
0
0

Which of the following is the correct syntax to set GPIO pin 12 as an output in Python?

easy📝 Syntax Q3 of 15
Raspberry Pi - Platform
Which of the following is the correct syntax to set GPIO pin 12 as an output in Python?
AGPIO.pinmode(12, GPIO.OUT)
BGPIO.output(12, GPIO.OUT)
CGPIO.setup(12, GPIO.OUT)
DGPIO.setmode(12, GPIO.OUT)
Step-by-Step Solution
Solution:
  1. Step 1: Understand GPIO.setup usage

    The GPIO.setup(pin, mode) function sets a pin as input or output.
  2. Step 2: Correct function and parameters

    To set pin 12 as output, use GPIO.setup(12, GPIO.OUT).
  3. Final Answer:

    GPIO.setup(12, GPIO.OUT) -> Option C
  4. Quick Check:

    Pin setup syntax = GPIO.setup(pin, GPIO.OUT) [OK]
Quick Trick: Use GPIO.setup to configure pin mode [OK]
Common Mistakes:
  • Using GPIO.output to set mode
  • Wrong function names
  • Mixing setmode with setup

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes