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.

EasyTechnical
0 practiced
Write a minimal Python script to benchmark inference latency for a PyTorch model (nn.Module). Requirements: accept a sample input shape, run warm-up iterations, run N measured iterations, use torch.cuda.synchronize() when on GPU, and print p50, p95, and p99 latency percentiles in ms. Show the measurement loop.
MediumTechnical
0 practiced
Explain causes of vanishing and exploding gradients in deep neural networks. For each cause, propose concrete debugging steps (what to log, what tests to run) and fixes such as improved initialization (Xavier/He), normalization layers, skip connections, activation functions, and gradient clipping.
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.
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.
HardSystem Design
0 practiced
Architect an end-to-end testing, debugging, and optimization framework for training a large transformer model across multi-node, multi-region clusters using spot instances. Include reproducibility, sharded checkpoints, profiling hooks, automatic failover and requeueing, cost control, and verification tests that assert model quality after resume. Describe components and interactions.

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.