InterviewStack.io LogoInterviewStack.io

Error Handling and Defensive Programming Questions

Covers designing and implementing defensive, fault tolerant code and system behaviors to prevent and mitigate production failures. Topics include input validation and sanitization, null and missing data handling, overflow and boundary protections, exception handling and propagation patterns, clear error reporting and structured logging for observability, graceful degradation and fallback strategies, retry and backoff policies and idempotency for safe retries. Also address concurrency and synchronization concerns, resource and memory management to avoid exhaustion, security related input checks, and how to document and escalate residual risks. Candidates should discuss pragmatic trade offs between robustness and complexity, show concrete defensive checks and assertions, and describe test strategies for error paths including unit tests and integration tests and how monitoring and operational responses tie into robustness.

MediumTechnical
0 practiced
You receive a Pickle-serialized model artifact from a teammate and must load it in production. Describe the security risks and defensive steps you should take before deserializing, alternatives to pickle, and policies you would recommend to the team to avoid remote code execution vulnerabilities.
MediumTechnical
0 practiced
Design a small runbook for on-call engineers to follow when a model-serving cluster begins returning frequent 500 errors or timing out. The runbook should include immediate mitigation steps, diagnosis commands, metrics to inspect, safe rollbacks, and communication templates for affected stakeholders.
EasyTechnical
0 practiced
Input coming from external systems can include malicious or malformed values. For ML systems that accept feature payloads or serialized artifacts, describe security-oriented input checks you would put in place to defend against injection, deserialization attacks (e.g., pickles), and excessively large payloads.
MediumTechnical
0 practiced
You have an external inference service that sometimes fails transiently. Design a retry and idempotency strategy for an ML client that must avoid duplicate downstream side-effects (e.g., billing events). Describe how to generate idempotency keys, where to store them, TTL considerations, and how to handle concurrent retries from multiple clients.
HardTechnical
0 practiced
During large-scale training jobs you occasionally get CUDA OOM errors. Describe a systematic runtime strategy to detect impending OOM, mitigate it safely, and continue training where possible. Include automatic batch-size reduction, checkpointing, graceful abort with diagnostics, and other runtime safeguards.

Unlock Full Question Bank

Get access to hundreds of Error Handling and Defensive Programming interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.