InterviewStack.io LogoInterviewStack.io

Code Quality and Debugging Practices Questions

Focuses on writing maintainable, readable, and robust code together with practical debugging approaches. Candidates should demonstrate principles of clean code such as meaningful naming, clear function and module boundaries, avoidance of magic numbers, single responsibility and separation of concerns, and sensible organization and commenting. Include practices for catching and preventing bugs: mental and unit testing of edge cases, assertions and input validation, structured error handling, logging for observability, and use of static analysis and linters. Describe debugging workflows for finding and fixing defects in your own code including reproducing failures, minimizing test cases, bisecting changes, using tests and instrumentation, and collaborating with peers through code reviews and pair debugging. Emphasize refactoring, test driven development, and continuous improvements that reduce defect surface and make future debugging easier.

MediumTechnical
0 practiced
Describe how you would instrument a PyTorch training loop to trace GPU memory allocations over time and detect memory leaks or gradual memory growth. List specific APIs and external tools (torch.cuda.memory_allocated, torch.cuda.memory_summary, tracemalloc, nvprof / Nsight Systems) and a minimal monitoring script you would run on CI/experiments.
MediumTechnical
0 practiced
Explain how you would use property-based testing (Hypothesis) to test data augmentation pipelines for image models. Provide a short Hypothesis strategy example (e.g., generating images with random sizes, channels, and ranges) and list properties you would assert (shape invariants, label-preserving transforms, no out-of-range pixel values).
HardTechnical
0 practiced
Design a testing and safety pipeline for a large generative language model (e.g., fine-tuned GPT) before deployment. Include automated checks (toxicity filters, prompt-injection tests, hallucination detection heuristics), human review steps, adversarial test suites, and acceptance criteria for promotion to production.
HardTechnical
0 practiced
How would you apply mutation testing to ML utility code (e.g., preprocessing, metric computations) to evaluate the effectiveness of your unit tests? Which mutation operators make sense (e.g., swap operators, change constant values, remove a normalization step) and how would you interpret mutation score for the team?
EasyTechnical
0 practiced
Implement unit tests (using pytest) and minimal production code in Python for a data preprocessing function 'normalize_image' that takes a NumPy array image with dtype uint8 in range [0,255] and returns a float32 array in range [0,1]. Include tests for edge cases: empty array, non-uint8 dtype, and shapes (H,W) and (H,W,C). Provide the function signature in Python and the pytest tests you would write.

Unlock Full Question Bank

Get access to hundreds of Code Quality and Debugging Practices interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.