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
Write pytest unit tests for the Python function normalize_features(features: dict) -> dict that: (a) scales numeric features to [0,1], (b) leaves categorical features unchanged, (c) handles missing numeric values by imputation with column median, (d) avoids division by zero when all values equal, and (e) does not mutate the input dict. Provide sample test cases and explain assertions.
MediumSystem Design
0 practiced
Design an approach to detect and handle silent failures in batch jobs where the job exits with zero but produces missing or empty outputs (common in ETL). Propose detection heuristics (checksums, output size, row counts vs watermark), heartbeats, manifest files, and idempotent re-run strategies. Provide an architecture sketch and explain how to surface actionable alerts.
HardSystem Design
0 practiced
Design a CI/CD pipeline for ML models that enforces code quality and runtime safety: linting/type-checks, unit tests, integration tests with golden datasets, model artifact signing, performance (latency/accuracy) regression checks, and canary rollout. Describe what happens when an artifact fails a performance gate mid-pipeline and how to prevent bad artifacts from reaching production.
HardTechnical
0 practiced
You're seeing subtle, reproducible differences in model outputs after scaling distributed training from 2 to 8 nodes. Outline a detailed debugging approach to find the root cause: creating a deterministic reproducer, logging checksums of intermediate activations, comparing outputs layer-by-layer, examining floating-point nondeterminism, differing library/build versions, and validating data sharding. Provide a prioritized step-by-step plan.
EasyTechnical
0 practiced
Design a lightweight validation layer for incoming training datasets (CSV or Parquet). Requirements: check for required columns, types, allowed ranges, null-rate thresholds, presence and uniqueness of id column, and support schema evolution with backward-compatible changes. Provide a Python example using pydantic (or dataclasses) for row schema and explain how you'd apply batch validations efficiently without per-row Python loops.

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.