InterviewStack.io LogoInterviewStack.io

Edge Case Identification and Testing Questions

Focuses on systematically finding, reasoning about, and testing edge and corner cases to ensure the correctness and robustness of algorithms and code. Candidates should demonstrate how they clarify ambiguous requirements, enumerate problematic inputs such as empty or null values, single element and duplicate scenarios, negative and out of range values, off by one and boundary conditions, integer overflow and underflow, and very large inputs and scaling limits. Emphasize test driven thinking by mentally testing examples while coding, writing two to three concrete test cases before or after implementation, and creating unit and integration tests that exercise boundary conditions. Cover advanced test approaches when relevant such as property based testing and fuzz testing, techniques for reproducing and debugging edge case failures, and how optimizations or algorithmic changes preserve correctness. Interviewers look for a structured method to enumerate cases, prioritize based on likelihood and severity, and clearly communicate assumptions and test coverage.

HardTechnical
73 practiced
Explain numeric edge cases introduced by mixed-precision training (fp16) and quantization (INT8). Design tests that detect gradient underflow, overflow, sudden loss spikes, and severe accuracy degradation after quantization. Suggest mitigations such as dynamic loss scaling, clipping, and calibration, and describe how you would validate each mitigation with tests.
EasyTechnical
82 practiced
Write two pytest tests (pseudo-code acceptable) that verify a saved model can be serialized and deserialized without significantly changing deterministic predictions. Use scikit-learn or PyTorch semantics and include: (1) save/load preserving outputs within tolerance for numeric models, and (2) behavior when the saved file is missing or corrupted. State expected tolerances and behaviors.
EasyTechnical
69 practiced
You implement padding and truncation logic for sequences with max_seq_len=128 for an NLP model. Write test cases that validate correct behavior for input lengths 0, 127, 128, and 129, including attention masks and special token placement. Describe off-by-one risks and how your tests catch them.
EasyTechnical
68 practiced
You have a function normalize(arr: np.ndarray) -> np.ndarray that standardizes a numeric vector to zero mean and unit variance. Write two to three pytest unit tests in Python that validate behavior for: (1) an empty array, (2) a constant array (zero variance), and (3) an array containing NaN or Inf. State the expected result or exception for each case and show the test inputs and assertions.
MediumTechnical
80 practiced
You must follow Test-Driven Development (TDD) for a new scoring microservice. Produce an ordered list of tests you would write before implementation, including unit tests for preprocessors, schema/contract tests, mocked inference tests, latency SLAs, and integration tests with the feature store. Explain why you chose the order and what constitutes a passing vs failing test.

Unlock Full Question Bank

Get access to hundreds of Edge Case Identification and Testing interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.