InterviewStack.io LogoInterviewStack.io

Debugging Testing and Optimization Questions

Core engineering skills for identifying, diagnosing, testing, and improving code correctness and performance. Covers approaches to finding and fixing bugs including reproducible test case construction, logging, interactive debugging, step through debugging, and root cause analysis. Includes testing strategies such as unit testing, integration testing, regression testing, test driven development, and designing tests for edge cases, boundary conditions, and negative scenarios. Describes performance optimization techniques including algorithmic improvements, data structure selection, reducing time and space complexity, memoization, avoiding unnecessary work, and parallelism considerations. Also covers measurement and verification methods such as benchmarking, profiling, complexity analysis, and trade off evaluation to ensure optimizations preserve correctness and maintainability.

MediumTechnical
0 practiced
Write a pytest regression test (Python) that loads a baseline model artifact (baseline.pkl) and a newly trained model (new_model.pt), runs a small validation dataset through both, and asserts that validation accuracy of the new model does not drop more than 2% compared to baseline. Include handling for RNG seeds and deterministic evaluation.
EasyTechnical
0 practiced
You observe flaky unit tests in CI that intermittently fail with OOM or GPU allocation errors. Describe a step-by-step triage plan to identify root cause and stabilize tests. Include how to collect deterministic repro, isolate environment vs code, add guards or resource constraints, and make CI robust against hardware variance.
MediumTechnical
0 practiced
Explain how to design fair and reproducible benchmarks comparing different model implementations for throughput and latency. Discuss warm-up runs, fixed hardware, multiple iterations, percentiles (p50/p95/p99), controlling for batching and JIT differences, and how to report variance and statistical confidence.
EasyTechnical
0 practiced
Given the function signature in Python:
def preprocess_text(s: str) -> str: """Lowercase input, remove punctuation (. , ! ?), collapse repeated whitespace, and strip."""
Write pytest unit tests that cover: normal sentence, empty string, punctuation-only input, unicode characters, and a very long input. Show at least 5 tests and explain expected assertions.
HardTechnical
0 practiced
Implement a numerically stable log-sum-exp function and stable softmax in Python/NumPy for inputs that can be large in magnitude. Show how stable log-sum-exp avoids overflow/underflow and give complexity analysis. Also show how to use stable softmax to compute cross-entropy safely.

Unlock Full Question Bank

Get access to hundreds of Debugging Testing and Optimization interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.