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.

EasyTechnical
0 practiced
Describe the difference between printing to stdout and using a structured logging framework in ML services. What metadata should you include in logs for model training and inference (examples: correlation IDs, model version, dataset snapshot id, GPU id)? Explain how structured logs help debugging and downstream observability systems.
HardSystem Design
0 practiced
Design an online inference architecture for multiple tenants where noisy neighbors can cause degraded performance. Explain rate limiting, backpressure, isolation (CPU/GPU/qos), and error-handling policies (429 vs queueing vs degrading model quality). How would you instrument to detect noisy neighbors?
MediumTechnical
0 practiced
Write a Python helper `run_subprocess(cmd: List[str], timeout: int) -> str` that runs a subprocess, captures stdout/stderr, times out after `timeout` seconds, and raises a custom `SubprocessError` including exit code and stderr. Show the implementation logic focusing on error mapping, timeouts, and sanitizing large stderr outputs.
HardSystem Design
0 practiced
Design a safe model update process for a stateful recommender that requires coordinated updates to model weights, feature store mappings, and offline recomputation pipelines. The process should guarantee no partial updates are visible in production and provide rollback procedures. Outline components, orchestration, and failure modes.
EasyTechnical
0 practiced
Write a simple pytest unit test for a function `normalize_features(arr: np.ndarray) -> np.ndarray` which should raise a ValueError when the input contains NaNs or infinities. Show one well-structured test that checks both NaN and infinite cases by mocking input arrays.

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.