Quiz: Digital I/O, PWM, and the MicroPython Workflow¶
Test your understanding of digital I/O, PWM, and the MicroPython workflow with these review questions.
1. What is PWM (pulse-width modulation)?¶
- A component built into the Pico's chip that converts a continuously varying voltage into a discrete numeric value
- A diagnostic mode that checks whether two points in a circuit are electrically connected
- A standard used by the Pico's GPIO pins where a signal near 3.3 volts represents "high"
- A technique that simulates a variable analog output using a digital pin by rapidly switching it on and off and varying the fraction of time it's on
Show Answer
The correct answer is D. PWM simulates a variable analog output using only a digital pin by rapidly switching it on and off many times per second and varying the fraction of time it spends on, so an LED's brightness or a motor's speed averages out to something in between fully on and fully off. Option A describes an ADC, option B describes a continuity test, and option C describes 3.3 volt logic.
Concept Tested: PWM
2. What is debounce?¶
- A technique for measuring resistance across a component
- The process of filtering out the rapid, unintended on-off signal fluctuations a mechanical button produces immediately after being pressed
- A drawing convention that represents a resistor with a zigzag symbol
- The percentage of each PWM cycle spent in the "on" state
Show Answer
The correct answer is B. Debounce is the process of filtering out the rapid, unintended on-off signal fluctuations a mechanical button or switch produces in the first few milliseconds after being pressed or released, before its contacts settle into a stable state. Option A describes a multimeter's resistance function, option C describes a schematic symbol, and option D describes duty cycle, a related but different PWM concept.
Concept Tested: Debounce
3. Which statement correctly distinguishes a short circuit from an open circuit?¶
- A short circuit is an unintended low-resistance path that lets current flow much higher than intended, while an open circuit is a break that stops current from flowing at all
- A short circuit stops current from flowing entirely, while an open circuit allows too much current to flow
- Both a short circuit and an open circuit are diagnosed the same way and produce identical symptoms
- A short circuit only occurs in parallel circuits, while an open circuit only occurs in series circuits
Show Answer
The correct answer is A. A short circuit is an unintended, low-resistance connection that lets current flow far higher than intended, generating heat and potentially damaging components, while an open circuit is a break in the intended path that stops current from flowing at all. Option B reverses these definitions. Option C is false since the chapter's symptom table shows different confirmations for each, and option D invents a restriction not found in the chapter.
Concept Tested: Short Circuit
4. In a parallel circuit, what happens to voltage and current compared to a series circuit?¶
- The same current flows through every parallel branch, but voltage varies across each one
- Total resistance in a parallel circuit is always the sum of each branch's resistance, just like in series
- Each parallel branch has its own independent current, but the same voltage is applied across every branch
- Parallel circuits cannot include a power rail, only series circuits can
Show Answer
The correct answer is C. In a parallel circuit, components are connected along multiple separate paths between the same two points, so each path can carry its own independent current while the same voltage is applied across every parallel branch. Option A reverses this relationship. Option B incorrectly applies the series resistance rule (sum of resistances) to parallel circuits, and option D invents a restriction not supported by the chapter.
Concept Tested: Parallel Circuit
5. Why does a microcontroller need an analog-to-digital converter (ADC) to read a sensor like a photoresistor?¶
- Because digital output pins cannot drive an LED without first passing through an ADC
- Because without an ADC, the microcontroller could only perceive signals in on/off terms, but light level changes continuously rather than in two discrete states
- Because an ADC is required to debounce a button's raw electrical signal
- Because an ADC converts MicroPython code into machine instructions the Pico's processor can execute
Show Answer
The correct answer is B. An ADC measures a continuously varying input voltage and converts it into a discrete numeric value a program can work with; without one, a microcontroller could only perceive the world in stark on/off terms, which is far too limited for a gradually changing signal like light level. Option A misapplies the ADC to digital outputs, option C confuses it with debouncing, and option D confuses it with code compilation.
Concept Tested: Analog To Digital Converter
6. A PWM signal has a period of 20 milliseconds, and the pin is driven high for 5 milliseconds of each cycle. What is the duty cycle?¶
- 5%
- 20%
- 25%
- 75%
Show Answer
The correct answer is C. Duty cycle is the percentage of each PWM cycle spent in the "on" (high) state. Here, 5 milliseconds of "on" time out of a 20-millisecond period is 5/20 = 0.25, or 25%. Option A confuses the raw millisecond value with a percentage, option B miscalculates the ratio, and option D would require 15 of the 20 milliseconds to be "on," which is not the case here.
Concept Tested: Duty Cycle
7. An LED circuit that worked yesterday now won't light at all, even though every wire looks physically connected. Applying the diagnostic guidance from this chapter, what should the student do first with a multimeter?¶
- Measure the resistor's exact resistance value to three decimal places
- Replace the LED, since a dead LED is the only possible explanation for a circuit that stops working
- Increase the supply voltage until the LED lights, then work backward
- Run a continuity test on each wire segment in the path to find the one that doesn't beep, indicating an open circuit
Show Answer
The correct answer is D. The chapter's symptom reference lists "component won't turn on at all" as most likely an open circuit, confirmed by continuity testing each wire segment until one doesn't beep. Option A tests a value that isn't the likely fault here. Option B jumps to replacing a part without diagnosing first, and option C is unsafe and does not follow the chapter's structured diagnostic approach.
Concept Tested: Continuity Test
8. In the blink-an-LED program, a student changes both sleep(0.5) calls to sleep(0.05). What is the most likely observed effect?¶
- The LED will blink so quickly that it may appear to be dimly and continuously lit rather than clearly flashing
- The LED will stop blinking entirely and stay off
- The program will raise an error because sleep() cannot accept values below 0.5
- The LED's forward voltage will change, requiring a new current-limiting resistor
Show Answer
The correct answer is A. Shortening the on and off delays to 0.05 seconds makes the LED switch far faster than the human eye can cleanly perceive as separate flashes, similar to how PWM's rapid switching averages out to an apparent brightness. Option B is incorrect since the program still toggles the pin. Option C is false — sleep() accepts any positive value. Option D confuses software timing with an unrelated hardware property.
Concept Tested: Blink An LED
9. A student built several circuits over the semester on the same Pico. After handling the board in a dry classroom without touching anything grounded first, the Pico begins behaving strangely — some pins seem unreliable, but the board never showed an obvious moment of failure. What is the most likely explanation, based on this chapter?¶
- The Pico's 3.3 volt logic level gradually decreased over time due to normal use
- The MicroPython interpreter needs to be reinstalled after prolonged use
- Static discharge silently damaged part of the Pico's internal circuitry without producing a felt or visible shock
- The breadboard's rows lost their internal connectivity from repeated component insertion
Show Answer
The correct answer is C. The chapter warns that static discharge can silently destroy a microcontroller's internal circuitry even at a voltage too low for a person to feel, and that a chip damaged this way often doesn't fail obviously — it just behaves strangely in ways that are hard to debug. Option A misattributes the symptom to normal wear, option B misdiagnoses a software cause, and option D describes a breadboard fault unrelated to handling the bare Pico.
Concept Tested: Static Discharge
10. A student wires a button as a digital input and writes code to count button presses, but the counter jumps by 5-10 for what feels like a single press. The wiring matches the chapter's pull-up resistor diagram exactly. What is the most likely underlying cause?¶
- The button is wired with the wrong LED polarity
- The GPIO pin is configured as a digital output instead of a digital input
- The Pico's ADC is misreading the button's voltage as a continuously varying signal
- The program does not debounce the button, so it is registering the mechanical contacts' rapid bounce as multiple separate presses
Show Answer
The correct answer is D. A mechanical button's contacts bounce rapidly between high and low for a few milliseconds before settling, and without debouncing, a program can register five or ten transitions from a single real press. Option A misapplies LED polarity, a concept unrelated to buttons. Option B is inconsistent with the wiring working well enough to register presses at all, and option C misapplies the ADC, which digital pin reads do not use.
Concept Tested: Debounce