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
0 practiced
You have service, infra, and data layers. How should exceptions be translated as they cross layer boundaries? Describe an approach to wrap lower-level exceptions into higher-level ones without losing diagnostics and how to avoid exception type explosion across bounded contexts.
MediumSystem Design
0 practiced
Design logging and observability for a model inference microservice that serves 5k requests/s. List the key metrics, structured log fields, tracing span design (what to instrument), and how you'd surface failures like 5xx spikes, elevated latency, or anomalous outputs (e.g., constant prediction).
EasyTechnical
0 practiced
You're writing shell scripts to prepare data for training. Explain the role of `set -e`, `set -u`, and `trap` for error handling in bash. Provide an example snippet that ensures the script exits on errors, treats unset variables as errors, and performs cleanup (deleting a temporary working directory) even when interrupted.
MediumTechnical
0 practiced
How would you handle schema evolution when feature names change or new features appear in production? Describe validation at training and inference time, compatibility strategies (adding default values, deprecation warnings), and how to roll out breaking schema changes safely.
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.

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.