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.

HardTechnical
103 practiced
You are hiring SREs to improve code quality. Design a 60-minute interview exercise focused on error handling and maintainable code for a mid-senior candidate. Include the prompt, constraints, expected deliverables, and a scoring rubric that tests correctness, defensive design, testability, and clarity of error messages. Explain how you would grade borderline solutions.
HardTechnical
145 practiced
As the SRE lead you discover a service has exhausted its error budget mid-quarter, blocking features. Create an operational plan: immediate mitigations to reduce customer impact, engineering work to repair reliability, stakeholder communication, prioritization of work against features, and metrics to track recovery. Include how to structure weekly checkpoints and cross-team responsibilities.
MediumTechnical
79 practiced
Design alerting rules that minimize noisy alerts for error logs while still catching real reliability regressions. Explain grouping strategies, using error rate normalized by traffic (error ratio), minimum sample sizes, and combining static thresholds with anomaly detection. Provide a PromQL-like pseudo expression to alert when error ratio exceeds 1% over 5 minutes with a minimum of 1000 requests.
EasyTechnical
74 practiced
Design a small Python helper function format_error_log(exc: Exception, context: dict) -> dict that returns a structured log record suitable for ingestion into a logging pipeline. Keys should include timestamp, level, service, correlation_id, error_type, message, and a short_stack. Use only standard library modules. Describe how you would limit sensitive data and ensure logs are parsable.
EasyTechnical
91 practiced
As an SRE, you must standardize error log messages for services. Propose a structured JSON log schema for exceptions and provide three example log entries for: a client validation error, a downstream timeout, and an internal null pointer exception. Explain which fields to include (for example timestamp, level, service, env, request_id, user_id, error_type, message, stacktrace) and when to include stacktrace versus sampling stacktraces to reduce noise.

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.