You're sending telemetry from a fleet of battery-powered IoT devices over flaky cellular links. How do you decide on the messaging protocol and the delivery guarantees, for example MQTT QoS levels versus something like CoAP?

technical-conceptual · Mid level · software-engineering

What the interviewer is really asking

Assesses whether the candidate can choose an IoT application protocol on the real constraints — power/battery, network reliability, and required delivery semantics — understanding MQTT's broker/pub-sub model with QoS 0/1/2 versus CoAP's lightweight UDP request-response for ultra-constrained devices, and the trade-offs of each.

What to say

What to avoid

Example answers

Strong: I'd decide from the constraints: power budget, how lossy the link is, and what guarantee each message actually needs. MQTT is broker-based pub/sub over TCP with QoS you can tune — 0 is fire-and-forget and cheapest, 1 is at-least-once but can duplicate so consumers must be idempotent, 2 is exactly-once and the most expensive. It's great for fleet coordination, retained state, and queuing while a device is offline. CoAP is a lightweight UDP request/response for ultra-constrained, battery-sensitive devices where holding a TCP connection and a broker session would drain power. I'd set QoS per topic, not globally: routine samples go QoS 0 because the next reading replaces a lost one, while commands or billing events go QoS 1 with idempotent handling. On flaky cellular I'd rather lean on idempotency than pay for QoS 2 everywhere, and I'd consider CoAP if the power budget can't afford a persistent connection.

Weak: I'd use MQTT with QoS 2 on everything so we never lose a message and never get duplicates — that's the safest setting. The broker handles reliability for us, so we don't really have to worry about the flaky network. CoAP I'd skip; MQTT is the more popular IoT protocol so it's the safer pick overall.

Want questions matched to your role? Paste a job title, job description, or CV and get a personalized set, or go Pro to unlock the full bank.