Debug a Test-Driven C++ Project
Company: Amazon
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Online Assessment
# Debug a Test-Driven C++ Project
A supplied C++ repository includes a README and test script. Diagnose and repair the project when tests fail because of possible syntax errors, incomplete functions, or logic defects. Explain how you would use a constrained AI assistant without asking it to produce the answer directly, and leave enough time for a clean submission.
### Constraints & Assumptions
- Treat the repository and its tests as the source of truth.
- Do not make broad rewrites before identifying the first failure.
- The final state must build, pass the relevant tests, and contain only intended changes.
### Clarifying Questions to Ask
- What does the README define as expected behavior?
- Does the project fail to compile, link, start, or satisfy an assertion?
- Which files and tests are in scope, and are hidden tests likely to exercise boundaries?
```hint Fix the first broken boundary
Classify the earliest failure before searching later logic; one syntax or build error can hide every downstream test.
```
### What a Strong Answer Covers
- A disciplined read-build-test-inspect loop.
- Separation of syntax, incomplete implementation, and behavioral failures.
- Small patches plus targeted regression tests and edge-case reasoning.
- Diff review, clean build, full test rerun, and submission-time management.
### Follow-up Questions
1. How would you proceed if the visible tests all pass but hidden tests fail?
2. What evidence would justify refactoring instead of making a local repair?
Quick Answer: Use a disciplined workflow to repair syntax, incomplete-function, and logic failures in a test-driven C++ project with bounded AI assistance.