Top 100 Firmware Engineer Practice MCQs
Every question on one page: open one, choose an answer, and see why at once. Signed in, your latest answer to each question counts, and you can answer again after 24 hours.
Curated: · Written: · Reviewed: —
This collection is currently unranked practice while editorial review is pending.
MCQ-1A new board has correct power rails but the core never leaves reset and no code has ever run on it. Which hardware check should be done first before writing or flashing firmware?
Answer to see the discussion.
MCQ-2A Cortex-M driver at `-O2` polls the status register at `0x40001000` in `while (!(REG->STATUS & READY)) {}` but the loop hangs after hardware sets READY. Which access pattern makes the loop observe the bit?
Answer to see the discussion.
MCQ-3A bare-metal C firmware has `uint8_t rx_ready;` set to nonzero by a UART ISR and polled in `while (rx_ready == 0) {}` in main. At -O2 the loop never exits despite the ISR running. What declaration fixes the flag?
Answer to see the discussion.
MCQ-4A bare-metal device has 64KB SRAM shared by a variable-size telemetry heap and a DMA controller requiring a 4KB contiguous buffer aligned to 32 bytes. Telemetry allocations fragment the heap during operation, and the buffer must stay valid for the device lifetime. Which allocation should the firmware use for the DMA buffer?
Answer to see the discussion.
MCQ-5A Cortex-M bare-metal image has its linker map showing `.data` with VMA in RAM and LMA in flash, and startup code zeroes `.bss` before calling `main`. At `main`, initialized globals read as zero despite correct flash contents. Which startup step is missing?
Answer to see the discussion.
MCQ-6A bare-metal firmware stack grows downward toward an adjacent heap, and an overflow silently corrupts heap data without faulting. Which canary placement detects the overflow on return?
Answer to see the discussion.
MCQ-7A FreeRTOS firmware guards a shared peripheral with a binary semaphore from `xSemaphoreCreateBinary()`. A high-priority task blocks on it while a low-priority holder is preempted by a medium task for an unbounded period, despite priority inheritance being enabled, and that medium task must still preempt the holder promptly for an unrelated safety check. Which change bounds the high task's wait?
Answer to see the discussion.
MCQ-8A Cortex-M4 running FreeRTOS meets its 2 ms control deadline at a 100 Hz tick but misses it at 1000 Hz, with the SysTick ISR and context switches consuming most of the CPU. Which tick or scheduling change restores the deadline without changing the control task code?
Answer to see the discussion.
MCQ-9A Cortex-M timer ISR at 1 kHz takes 200 µs: PID 150 µs, ADC capture 20 µs, PWM update 10 µs and buffered UART logging 5 µs. The control loop task must start within 50 µs of the tick to hold PWM phase, but the ISR delays it. Which ISR design change preserves latency and correctness?
Answer to see the discussion.
MCQ-10An 8-bit MCU has a 32-bit counter incremented in a timer ISR and read by a main-loop task, and reads sometimes return torn values. Which critical section makes the read safe?
Answer to see the discussion.
MCQ-11A Cortex-M7 receives Ethernet frames via DMA into a cacheable SRAM buffer, and the DMA-complete interrupt fires, yet the CPU keeps reading the previous frame's bytes. Which cache maintenance operation on the receive buffer restores fresh data before the CPU reads it?
Answer to see the discussion.
MCQ-12A sensor datasheet specifies CPHA=1 with CPOL=0, but the MCU driver is set to CPHA=0 with CPOL=0. Reads return each byte shifted by one bit, and setting CPHA=1 fixes them. Which mismatch caused the shift?
Answer to see the discussion.
MCQ-13A slave resets mid-transfer and holds `SDA` low while `SCL` stays idle high, so the master sees a busy bus and no new `START` is accepted. Which recovery sequence should the master perform to release the slave and restore the bus?
Answer to see the discussion.
MCQ-14A UART link works reliably at `115200` baud but drops bytes at `230400` baud with identical polling code. Which cause should be checked first?
Answer to see the discussion.
MCQ-15A sensor requires a `10 MHz` SPI clock for burst reads and shares a bus with two peripherals that tolerate only `400 kHz` I2C. The MCU has three spare GPIOs for chip selects, while the harness provides only two shared wires for I2C. Which bus choice meets the sensor timing without breaking the other devices?
Answer to see the discussion.
MCQ-16A Cortex-M bootloader at `0x00000000` jumps to an application linked at `0x00020000` after loading the application's initial stack pointer into `MSP` with interrupts disabled, and the application runs until a UART interrupt fires and vectors into the bootloader. Which vector relocation step is missing before the jump?
Answer to see the discussion.
MCQ-17A sealed sensor has flash banks A and B, with A running the current image and no external recovery port. Power can fail while an update is written to B, and the device must keep A for rollback while running the new image once it checks out. Which update sequence prevents bricking?
Answer to see the discussion.
MCQ-18A NOR flash driver writes a new word over a previously programmed word without erasing its sector first, and the write fails verification. Which flash constraint explains the failure?
Answer to see the discussion.
MCQ-19A raw NAND device near end of life shows rising correctable errors under its BCH ECC, plus uncorrectable errors in several blocks and factory bad blocks already marked. Firmware must preserve logical data without rewriting worn pages in place. Which bad-block handling is required for the uncorrectable blocks?
Answer to see the discussion.
MCQ-20A Cortex-M board in STOP2 draws 800uA at 3.3V while the MCU datasheet lists 2uA sleep current. The LDO is specified at 1uA quiescent current, but an unused GPIO tied to a sensor's SDA line is left floating while the sensor rail stays powered. Which leakage path should firmware audit first?
Answer to see the discussion.
MCQ-21A sensor draws `30 mA` for `10 ms` every `10 s` and `2 microamps` while sleeping, powered by a `2000 mAh` battery. What average current and battery life follow from that duty cycle?
Answer to see the discussion.
MCQ-22An MCU configures its PLL from the external crystal, but the `PLLLOCK` bit never sets and firmware proceeds at the wrong system clock. The internal RC oscillator remains running as the documented safe fallback. Which fallback source and status check should firmware use before enabling peripherals?
Answer to see the discussion.
MCQ-23A Cortex-M4 board faults on its first write to a timer register at `0x40030000`, which is reserved on this SKU, and enters HardFault. The handler can inspect CFSR, HFSR, BFAR and the stacked exception frame. Which combination identifies the faulting access and instruction?
Answer to see the discussion.
MCQ-24An SPI flash link runs at 20 MHz and passes CRC checks at 25°C but its MOSI commands corrupt at -40°C and 85°C. A logic analyzer at room temperature shows clean setup and hold margins. Which capture should the firmware engineer examine next?
Answer to see the discussion.
MCQ-25A Cortex-M0 firmware in 64KB flash uses virtual sensor drivers and C++ exceptions for I2C failures, but the map shows vtables plus unwind tables pushing it over budget and adding latency in the 1 kHz loop. The drivers are known at compile time and failures need only a status code. Which design should replace them?
Answer to see the discussion.
MCQ-26Two MCUs with different compilers exchange a struct with `uint16_t` and `uint32_t` fields over UART, and the receiver reads shifted values because each compiler inserts different padding. Deployed receivers expect little-endian wire bytes and a big-endian replacement MCU is planned, so which declaration makes the wire format stable?
Answer to see the discussion.
MCQ-27A pressure sensor returns unsigned raw values up to `60000`, and firmware computes `raw * 2` into a signed `int16_t` output. The downstream actuator accepts values only up to `30000` and faults above that, so high inputs must clamp at the actuator limit instead of wrapping negative. Which arithmetic prevents overflow and meets that limit?
Answer to see the discussion.
MCQ-28A Cortex-M4 IIR filter checks `if (acc + delta < acc) acc = INT_MAX; else acc += delta;` before adding a large positive `delta`. At `-O0` the clamp works, but at `-O2` large outputs wrap negative instead of clamping. Which undefined behavior and compiler assumption explain the failure?
Answer to see the discussion.
MCQ-29A 3.3 V I2C bus at 400 kHz has 180 pF total capacitance, a 1000 ns maximum rise time, and devices rated to sink 2 mA at VOL 0.4 V. The MCU pins are set open-drain, but no pull-up value has been chosen yet. Which pull-up configuration meets both limits?
Answer to see the discussion.
MCQ-30An ADC samples a 5 kHz sine wave at 1 kHz and the readings show a lower-frequency alias. Which sampling rate captures the original signal without aliasing?
Answer to see the discussion.
MCQ-31A 48 MHz timer drives a motor at `1 kHz`, producing audible whine and driver heating. Firmware must exceed 20 kHz, stay at or below 25 kHz for switching loss, keep at least 1024 duty steps, and preserve a 1 µs effective on-time after 400 ns dead time at 3% creep duty. Which PWM setting meets all four?
Answer to see the discussion.
MCQ-32A 16 MHz timer counts a 20 kHz encoder in periodic overflow mode with a high prescaler, servicing each overflow in an 8 us ISR. Low speeds count correctly, but high speeds lose pulses between overflows. Which timer configuration captures every edge?
Answer to see the discussion.
MCQ-33A `24C256` driver writes a page, then 1 ms later writes the next page and the EEPROM NACKs its device address, while a read issued 10 ms after the first write ACKs and returns the new data. What should the driver do after each write to handle this correctly?
Answer to see the discussion.
MCQ-34A Quad SPI flash driver must use Quad I/O, with command, address and data on four lines, for a `0xEB` fast read, but sets dummy cycles to zero and receives garbage. Which command and dummy-cycle setting matches the Quad I/O requirement?
Answer to see the discussion.
MCQ-35A Cortex-M receiver decodes every payload correctly, yet the CRC-16 check fails on all frames from a peer. For the `123456789` test vector the firmware computes `0xB129` while the peer expects `0x29B1` for the identical bytes. Which parameter mismatch should be checked first?
Answer to see the discussion.
MCQ-36A UART ISR produces bytes into a 256-byte ring while a slower main loop consumes them in order, and a stall lets arrivals exceed capacity. The unread stream must remain intact and the ISR cannot block. Which ownership and overflow design fits?
Answer to see the discussion.
MCQ-37A FreeRTOS task takes a binary semaphore guarding a shared SPI bus, and another task calls give on it while the first task is still using the bus, corrupting transfers. Which primitive and release rule prevents a non-owner from unlocking it?
Answer to see the discussion.
MCQ-38A Cortex-M FreeRTOS task paints its stack and shows ample watermark in normal operation, but the error path calls `snprintf` logging with a large local buffer and nested handlers. ISRs run on MSP while the task runs on PSP. Which stack sizing detects and prevents the overflow?
Answer to see the discussion.
MCQ-39A Cortex-M4 FreeRTOS device enables tickless idle, yet sleep current stays in milliamps. The 1 kHz SysTick remains enabled, the RTC wake timer is unconfigured, and the UART and SPI clocks stay on during idle. Which change lets the core enter its deepest sleep?
Answer to see the discussion.
MCQ-40A 3.3 V sensor node logs `BOD` resets and reboots after enabling its radio and motor, while the rail dips to 2.9 V and the MCU minimum is 2.7 V. The brownout threshold is 3.0 V with 200 mV hysteresis, and loads are already staggered 50 ms apart. Which setting stops the loop without running below specification?
Answer to see the discussion.
MCQ-41A first-spin board pulls its boot-mode pin high for flash boot, but the chip enters download mode instead. When does the hardware sample that strapping pin?
Answer to see the discussion.
MCQ-42A sensor requires `Vcore` before `Vio`, `Vio` 0.5 to 3 ms after `Vcore`, a `Vio` ramp of 1 to 10 ms, and `nRESET` held at least 5 ms after both rails reach tolerance. Firmware enables `Vcore` at 0 ms and `Vio` at 1 ms with a 4 ms ramp; `Vcore` stabilizes at 2 ms, `Vio` at 5 ms, and `nRESET` releases at 8 ms, after which the sensor latches up. Which requirement was violated?
Answer to see the discussion.
MCQ-43A point-to-point 50 MHz SPI clock on a 50 ohm trace rings at the receiver pin when measured with a spring ground tip, and the driver output impedance is 28 ohms. The receiver needs a fast edge for setup time but overshoots with the strongest drive. Which termination and drive setting damps the reflection while preserving the edge?
Answer to see the discussion.
MCQ-44A Cortex-M ROM bootloader jumps to any flash image and SWD stays enabled in production. Factory provisioning burned only an RSA public-key hash into OTP, with no secure element fitted. An unsigned image flashed via SWD boots. Which missing verification step prevents this?
Answer to see the discussion.
MCQ-45A production SoC ships in DEVELOPMENT with JTAG enabled and no debug password, allowing flash readout. Field returns still need authenticated failure analysis, passwords must be per-device, and the lifecycle transition is irreversible and blocks later fuse or password programming. Which sequence permanently locks unauthenticated JTAG extraction while preserving authenticated RMA debug?
Answer to see the discussion.
MCQ-46A Cortex-M MCU encrypts 16-byte telemetry blocks in software at 40 ms per block, missing a 1 ms deadline while the CPU must service a control loop. The device sleeps in STOP2 between blocks, clearing volatile accelerator key registers, DMA channel 1 is dedicated to ADC sampling, and the key must never sit in application RAM or external flash. Which accelerator configuration meets the deadline without exposing the key?
Answer to see the discussion.
MCQ-47A field device downloads a 512KB firmware image over a lossy metered link into its inactive flash slot, persisting a chunk map with per-chunk CRCs. Power fails mid-chunk at 90 percent, and the bootloader must never boot a partial image. Which update design meets both constraints?
Answer to see the discussion.
MCQ-48A factory programmer writes the same serial number into every unit, so cloud registration cannot distinguish devices. Which provisioning step is missing before the units leave the line?
Answer to see the discussion.
MCQ-49A fleet passes ICT and boundary-scan at 25°C, and passes 1000 hours at steady 85°C in the lab, yet fails intermittently after repeated enclosure heating and cooling cycles. Failures clear after cooling, with no corrosion or parametric drift. Which test gap explains the field failures?
Answer to see the discussion.
MCQ-50A Cortex-M7 DMA controller fills a 4096-byte receive buffer in cacheable AXI SRAM at an address ending in `0x10`, and the CPU scans the buffer forward sequentially while the cycle counter shows L1D cache misses dominating. The DMA controller cannot access DTCM RAM on this device. Which buffer change most improves the scan?
Answer to see the discussion.
MCQ-51A Cortex-M4 FreeRTOS task running in unprivileged thread mode writes a timer control register at `0x40030000` and takes a MemManage fault. Its MPU region covers that address as privileged read/write, Device memory, execute-never. What region change lets the task access the register safely?
Answer to see the discussion.
MCQ-52Secure firmware starts DMA from a buffer in non-secure RAM and reads it back without a veneer call. Which ownership rule does this violate?
Answer to see the discussion.
MCQ-53A Cortex-M node sleeps in STOP2 with its UART clock gated and must autobaud to a host at an unknown rate between 9600 and 115200. The host sends one real byte immediately on wake, but the receiver is not ready at its start bit. Which wake pattern and receiver timing preserves that byte?
Answer to see the discussion.
MCQ-54A battery node sleeps in STOP2 and a sensor holds its data-ready line high for 4 ms after crossing the threshold, with logging required within 10 ms of the crossing. Polling every 1 ms keeps the MCU awake too often, while a slower poll can miss the pulse entirely. Which polling interval and wake behaviour meets both constraints?
Answer to see the discussion.
MCQ-55A battery device uses an active-low tactile button on a GPIO interrupt, and a single press generates several falling edges over about 4 ms while the shortest intentional press lasts 80 ms. Firmware must report exactly one press per press without delaying detection beyond the bounce interval. Which edge and lockout design should it use?
Answer to see the discussion.
MCQ-56A FreeRTOS I2C driver busy-waits for a sensor response, stalling lower-priority tasks during its `100ms` timeout. The sensor signals completion via interrupt within milliseconds, and the timeout is only a ceiling for a hung transfer. Which driver design lets other tasks run while the transfer is pending?
Answer to see the discussion.
MCQ-57A Cortex-M0 in 64KB flash logs from a 1kHz ISR and HardFault handler, with only the SWO pin wired to the lab probe and the SWD data line disconnected. Enabling `printf` with `%f` adds 20KB and its UART retarget blocks on TX, while heap and RAM buffers may be corrupt in the fault. Which logging choice fits?
Answer to see the discussion.
MCQ-58A Cortex-M firmware grows from 180KB to 214KB after enabling LTO with `-ffunction-sections` and `--gc-sections`. All objects are linked directly with no static archives, and the map shows many small `.text.*` sections retained. Which analysis identifies the sections causing the growth?
Answer to see the discussion.
MCQ-59A parser test passes on a little-endian x86 host but fails on a big-endian target when the mock HAL returns a native `uint32_t` header. The wire format is a 32-bit little-endian header, and the mock currently supplies host-order integers instead of wire bytes. Which mock HAL and decoding choice makes the test portable?
Answer to see the discussion.
MCQ-60A Cortex-M main loop starts an SPI transfer and a higher-priority ISR fires mid-transfer and starts another transfer on the same peripheral, corrupting both. Which design prevents the ISR re-entry?
Answer to see the discussion.
MCQ-61A 9600 baud 8N1 RS485 bus uses 120 ohm termination at both ends and a shared DE/RE pin. The transceiver requires DE stay asserted for one character time after the final stop bit, and the master opens the next slot 1.5 character times after that bit. Which DE deassertion timing meets both limits?
Answer to see the discussion.
MCQ-62A `115200` baud UART link uses the MCU internal RC oscillator, which drifts beyond `3%` between `-40°C` and `85°C`, while the peer crystal is `±1%` and the receiver budget is `1.5%` total mismatch. The MCU crystal input is limited to `8 MHz` maximum, and an `8 MHz ±20 ppm` crystal is available. Which clock and oversampling choice keeps total baud mismatch within budget?
Answer to see the discussion.
MCQ-63A Cortex-M node in STOP2 draws 48 uA against a 4 uA datasheet figure. Unused, unconnected pin PA9 is a digital input with no pull, and enabling its pull-up only drops current to 14 uA, still above the 5 uA budget. Which pin configuration meets the budget?
Answer to see the discussion.
MCQ-64A board warm-resets the SoC while the eMMC supply stays powered, and firmware reuses its cold-boot flow by querying the operating window immediately. The device never answers and init times out, although the same flow works after a full power cycle. What missing step should precede that query?
Answer to see the discussion.
MCQ-65A full-speed USB device enumerates on first connection, but fails when the host issues a bus reset and re-enumerates it, probing address `0` while the device still answers at its old address with endpoints configured. What must firmware do on bus reset?
Answer to see the discussion.
MCQ-66A WiFi co-processor driven by AT commands over UART blocks during throughput testing and must move to native SDIO with DMA and RTS/CTS. Frames reach 1500 bytes, only 4096 bytes of SRAM are budgeted for receive buffers, and the next frame must arrive while the previous is processed. Which buffer design fits?
Answer to see the discussion.
MCQ-67A battery sensor runs fixed-period control every 1 ms, sampling every 20 ms and logging every 200 ms, plus a rare fault interrupt needing response within 50 µs. It must sleep in STOP2 between ticks and has no dynamic priorities or blocking calls. Which architecture meets latency and power with least complexity?
Answer to see the discussion.
MCQ-68A Cortex-M device feeds a `200ms` window watchdog from its main loop, but a flash sector erase blocks that loop for `500ms` while the system oscillator is gated. The erase is legitimate and the device must still reset if the main loop hangs. Which watchdog configuration prevents the erase reset?
Answer to see the discussion.
MCQ-69A Cortex-M4 runs a GPIO encoder ISR that takes 180 µs decoding quadrature, while a CAN ISR at a lower priority must respond within 40 µs. CAN frames are delayed whenever the encoder ISR runs. Which priority and ISR change meets the deadline?
Answer to see the discussion.
MCQ-70A Cortex-M driver writes the GO bit in a 32-bit control/status register at `0x40001000` and then polls its DONE bit in the same register, but at `-O2` the poll is hoisted above the write. Which cast, access width and barrier placement preserves the hardware sequence?
Answer to see the discussion.
MCQ-71A Cortex-M4 sensor allocates variable-length telemetry buffers with `malloc` every 100 ms and frees them after transmission, and after several days allocation fails despite free heap bytes remaining. It has 64KB SRAM, messages are 64, 256, or 1024 bytes, and buffers live only until transmit completes. Which allocation design prevents fragmentation?
Answer to see the discussion.
MCQ-72A Cortex-M driver writes payload words to `fifo[0]` then sets GO in `fifo[1]` through a plain pointer, but at `-O2` the peripheral sometimes starts before the payload lands. Which access and barrier ordering guarantees the payload reaches the FIFO first?
Answer to see the discussion.
MCQ-73A FreeRTOS controller runs a 1 ms control task and a 10 ms sensor task, both periodic, plus a logging task that arrives sporadically with a 100 ms deadline. Logging sits below both tasks and misses its deadline during bursts, while periodic deadlines still hold. Which priority and bandwidth scheme fixes logging without breaking periodic tasks?
Answer to see the discussion.
MCQ-74A Cortex-M7 DMA receiver writes frames into one cacheable buffer while its ISR and a task both access it, with no ownership flag. Which arrangement makes ISR-to-task handoff safe?
Answer to see the discussion.
MCQ-75An I2C master polls a slave that needs 18 ms after each ACK to fetch the next EEPROM page, while the master's `TIMEOUT` is 10 ms and the slave firmware caps stretching at 5 ms. The slave must release SCL within 35 ms per SMBus timeout, and a genuine timeout must not leave SCL held low. Which configuration completes the reads and recovers the bus?
Answer to see the discussion.
MCQ-76An MCU shares `SCLK`, `MOSI` and `MISO` between a display needing `CPOL=0, CPHA=1` and an SD card needing `CPOL=0, CPHA=0`, with separate `CS` lines. Firmware leaves both `CS` lines low between transfers, keeps one mode for both, and idles `SCLK` high, so reads return the other device's data. What bus configuration prevents the contention?
Answer to see the discussion.
MCQ-77A bootloader checks a signature over an image header declaring a 256KB payload, but the download stops after 180KB. It hashes the received bytes, the signature passes, and it jumps to the entry point. Which validation would have stopped the truncated image from booting?
Answer to see the discussion.
MCQ-78A sealed NOR flash device updates its config sector every minute while calibration sectors are written once at provisioning and cannot be rewritten after sealing. Its sector 0 has reached 90k erases while others are near zero. Which layout spreads the hot updates without moving cold data?
Answer to see the discussion.
MCQ-79A sensor node in STOP2 wakes on the latched data-ready GPIO but regulator restart takes 2.8 ms against a 1 ms deadline. STOP1 wake takes 0.35 ms, PLL lock takes 1.1 ms, and the 16 MHz HSI gives 8 MHz SPI against a 5 MHz sensor minimum, while the battery permits STOP1 but not Sleep. Which sleep, clock, and wake combination meets the deadline?
Answer to see the discussion.
MCQ-80A Cortex-M4 in STOP2 ignores SWD halt requests because its core clock is gated and the debug domain loses power. The datasheet notes the debug clock can be sourced from the always-on LSI in STOP2, and wake-on-debug wakes the core when the probe connects. Which configuration lets the debugger halt the core in STOP2?
Answer to see the discussion.
MCQ-81An MCU master reads a sensor over SPI at 8 MHz with CPOL=0 and samples MISO on the rising edge. A logic analyzer configured for the sensor's mode decodes every byte correctly, but the MCU duplicates the first bit and drops the last. The sensor changes MISO on the rising edge and holds it until the falling edge, so which sampling edge and input setup check explains the error?
Answer to see the discussion.
MCQ-82A Cortex-M4 UART handler running on MSP is preempted by a HardFault. The HardFault handler finds the stacked LR holds a thread-mode PSP value, so returning would pop the frame onto PSP and resume thread mode instead of the interrupted handler. Which EXC_RETURN value should the stacked LR have held?
Answer to see the discussion.
MCQ-83A Cortex-M4 motor controller corrupts its encoder count only at full speed, never when a breakpoint sits in the polling loop. Removing the breakpoint restores the fault, and building at `-O2` instead of `-O0` makes it more frequent. What mechanism best explains the disappearance under the debugger?
Answer to see the discussion.
MCQ-84A peripheral driver holds its register block in a `std::unique_ptr` with the default deleter. During shutdown the heap is disabled before the driver destructor runs, so the implicit `delete` faults. Which ownership change keeps cleanup safe during shutdown?
Answer to see the discussion.
MCQ-85An 8-bit MCU maps a 32-bit control register at `0x4000` with no hardware set/clear alias. Main sets one bit with `REG |= MASK` while a timer ISR clears another bit in the same register, and occasional lost updates appear. Which handling makes the update atomic?
Answer to see the discussion.
MCQ-86An FPU-less MCU runs a fractional filter using 16-bit samples in the range -1 to just below 1. Which Q format matches that representation?
Answer to see the discussion.
MCQ-87A C++17 packet parser on a little-endian Cortex-M4 extracts a 4-byte little-endian `uint32_t` length from a `uint8_t` receive buffer at offset one, using `*(uint32_t*)(buf + 1)`. Static analysis flags a strict aliasing violation and `-O2` miscompiles the surrounding checks. Which replacement extracts the length safely on this target?
Answer to see the discussion.
MCQ-88A STM32 SPI display driver uses `HAL_SPI_TransmitReceive` in polling mode at 8 MHz. A logic analyzer shows `CS` rising before the final byte's last clock, yet the HAL returns `HAL_OK` and no error callback fires. What trace distinguishes HAL polling completion from peripheral shift completion?
Answer to see the discussion.
MCQ-89A Cortex-M ADC runs `20000` samples per second into a single DMA buffer while the CPU spends long stretches in a busy control loop. The buffer overruns whenever processing delays the refill, losing samples, and the application requires the full sample rate. Which DMA and sampling design prevents the overrun?
Answer to see the discussion.
MCQ-90A PWM timer overflow is running faster than intended with its clock and `ARR` fixed. Which prescaler setting lowers the overflow frequency?
Answer to see the discussion.
MCQ-91A Cortex-M4 I2C driver runs in a 1 kHz ISR and uses `assert(status == OK)` on timeout, hanging the loop with no field diagnostics. The ISR cannot retry or block, the main loop can degrade on a flag, and a watchdog reset must preserve the cause. Which policy fits?
Answer to see the discussion.
MCQ-92A Cortex-M4 emits an 8-bit ITM stimulus packet of 2 bytes for every 10 µs control sample, and SWO at 1 MHz drops events. The probe caps SWO at 1.5 MHz, every sample must be traced, and the board wires the 4-bit TPIU trace port to the probe. Which trace change prevents sustained loss?
Answer to see the discussion.
MCQ-93Two engineers build the same firmware commit on different machines and get different ELF hashes despite identical source. One machine uses a newer cross-compiler, different optimization flags, an absolute build directory in debug info, and the SDK linker script instead of the repo copy. Laptops and CI are offline, share only the git repo, and the SDK plus CI runners update monthly, with no container registry. Which pinning approach makes the builds reproducible?
Answer to see the discussion.
MCQ-94A controller passes HIL timing tests at nominal load but misses deadlines in the field when CPU and bus load peak together. Which untested timing property explains the failure?
Answer to see the discussion.
MCQ-95A sealed node uses a fixed-size 2000 mAh cell for 10 years, waking every 30 s for 10 ms at 6 mA. MCU A sleeps at 4 uA with a 1 uA-quiescent regulator, while MCU B sleeps at 0.9 uA but its bundled regulator draws 18 uA quiescent; self-discharge adds 4 uA. Which MCU and regulator pairing meets the 10-year life?
Answer to see the discussion.
MCQ-96A product line ships Rev A and Rev B on the same MCU, with Rev B moving the sensor to a second I2C bus and changing the LED pin. Field units of both revisions must run one signed binary, and another peripheral change is planned next year. Which compatibility strategy scales without recompiling per revision?
Answer to see the discussion.