InterviewStack.io LogoInterviewStack.io

Error Handling and Code Quality Questions

Focuses on writing production quality code and scripts that are defensive, maintainable, and fail gracefully. Covers anticipating and handling failures such as exceptions, missing files, network errors, and process exit codes; using language specific constructs for error control for example try except blocks in Python or set minus e patterns in shell scripts; validating inputs; producing clear error messages and logs; and avoiding common pitfalls that lead to silent failures. Also includes code quality best practices such as readable naming and code structure, using standard libraries instead of reinventing functionality, writing testable code and unit tests, and designing for maintainability and observability.

MediumTechnical
80 practiced
You are responsible for testing a feature-store ingestion pipeline. Create a test plan that validates deduplication, ordering guarantees, watermark handling, schema changes, and late-arriving data. Include unit, integration, and property-based tests you would write, and example test cases to simulate duplicates, out-of-order events, and schema evolution.
MediumTechnical
105 practiced
Propose a strategy to detect, profile, and mitigate memory leaks in a long-running PyTorch model server. Include tools (tracemalloc, objgraph, nvidia-smi), periodic heap snapshots, GC tuning, GPU memory accounting, and a plan for automated mitigation (worker recycle, graceful restart). Explain how you would reproduce and write tests to catch regressions.
EasyTechnical
89 practiced
As an AI engineer maintaining a shared Python library, explain the benefits and trade-offs of adding static type annotations (PEP 484) and running mypy. Show a small annotated example: a Model class __init__ and an inference function. Discuss how to handle third-party libraries without type stubs, and how type checking fits into CI and refactors.
EasyTechnical
79 practiced
You're building an inference service that interacts with storage, GPU drivers, and a model runtime. Propose a custom exception hierarchy (BaseModelError and specific subclasses) in Python and explain how this hierarchy helps in selective catching, mapping to HTTP error codes, metrics labeling, and deciding retryability. Provide sample class definitions showing attributes like error_code and retryable.
MediumTechnical
84 practiced
Multiple processes may update model artifacts on local disk or a shared network filesystem. Describe approaches to ensure atomic updates and avoid corruption: write-to-temp-and-rename, advisory file locks, and coordination via an external service (etcd/DB). Discuss trade-offs regarding performance, complexity, and cross-host guarantees; include considerations for S3/object storage.

Unlock Full Question Bank

Get access to hundreds of Error Handling and Code Quality interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.