Bird
0
0

Why does GPIO.cleanup() not always fix issues if called multiple times in a program?

hard📝 Conceptual Q10 of 15
Raspberry Pi - GPIO Basics with Python
Why does GPIO.cleanup() not always fix issues if called multiple times in a program?
ABecause calling cleanup multiple times can reset pins prematurely
BBecause cleanup only resets pins used since last cleanup
CBecause cleanup disables the GPIO library permanently
DBecause cleanup causes the Raspberry Pi to reboot
Step-by-Step Solution
Solution:
  1. Step 1: Understand how GPIO.cleanup() works internally

    It resets pins that were set up since the last cleanup call.
  2. Step 2: Why multiple calls may not fix all issues

    If pins were set before last cleanup, they remain unchanged until next cleanup.
  3. Final Answer:

    Because cleanup only resets pins used since last cleanup -> Option B
  4. Quick Check:

    Cleanup resets recent pins only [OK]
Quick Trick: Cleanup resets pins used since last cleanup call [OK]
Common Mistakes:
  • Thinking cleanup disables GPIO permanently
  • Assuming cleanup reboots Pi
  • Believing multiple cleanup calls reset all pins always

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Raspberry Pi Quizzes