Bird
0
0

Given this code snippet:

medium📝 Predict Output Q5 of 15
Raspberry Pi - PWM Output
Given this code snippet:
pwm = GPIO.PWM(12, 2000)
pwm.start(50)
pwm.ChangeFrequency(1000)

What is the PWM frequency after execution?
A2000 Hz
B1000 Hz
C50 Hz
DCode will error out
Step-by-Step Solution
Solution:
  1. Step 1: Check RPi.GPIO PWM methods

    RPi.GPIO PWM object does not have a ChangeFrequency method.
  2. Step 2: Identify the error

    Calling pwm.ChangeFrequency(1000) will raise AttributeError since the method does not exist. Frequency is fixed at creation.
  3. Final Answer:

    Code will error out -> Option D
  4. Quick Check:

    No ChangeFrequency in RPi.GPIO PWM [OK]
Quick Trick: RPi.GPIO PWM frequency cannot be changed after creation [OK]
Common Mistakes:
  • Assuming ChangeFrequency exists
  • Confusing duty cycle with frequency
  • Thinking frequency stays at initial 2000 Hz

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes