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
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.
MediumTechnical
0 practiced
ML training tests sometimes fail because of randomness. Propose a robust testing strategy for model training pipelines addressing non-determinism: seeding RNGs, deterministic ops, tolerance thresholds, small synthetic datasets, and mocking external services. Then provide a pytest snippet that trains a tiny model on synthetic data with fixed seeds and asserts that loss decreases within a tolerance.
EasyTechnical
0 practiced
Given a Python preprocessing module with functions named m1 and m2, lots of nested loops, no docstrings, and mixed responsibilities (parsing, cleaning, feature extraction), propose a refactor plan to improve readability and maintainability. Cover renaming, extracting smaller functions, adding docstrings and type annotations, creating a module layout, and how you'd verify behavior didn't change during refactor (tests/mocks).
MediumTechnical
0 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.
HardTechnical
0 practiced
Provide a Python example that demonstrates a race condition when multiple processes try to write to the same checkpoint file. Then propose robust fixes to avoid corruption using POSIX file locks, atomic rename semantics, and a distributed lock (etcd) for multi-host coordination. Discuss performance and failure-mode trade-offs for each approach.

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.