Explain the real benefit of testing beyond 'catching bugs today'.
Show worked solution
A strong answer captures that testing's biggest payoff is confidence to change code without fear - enabling refactoring and growth - so tested code can evolve safely while untested code rots because it's too risky to touch.
Write a small test using Arrange-Act-Assert (or unittest) for a function.
Show worked solution
Good answers set up inputs (arrange), call the function (act), and assert the expected result, using a bare assert or unittest's assertEqual/assertRaises, with a clear focused test and sensible name.
For a function of your choice, list what you would and wouldn't test, including edge cases.
Show worked solution
Strong answers target the real logic and skip trivial code, and enumerate meaningful edge cases (empty, zero, negatives, first/last, invalid input) - showing testing is judgement, not testing everything.
Explain the red-green-refactor cycle of TDD and one benefit of writing the test first.
Show worked solution
Good answers describe writing a failing test (red), the simplest code to pass it (green), then cleaning up (refactor), and a benefit like forcing you to define 'done' first, or guaranteeing testable, well-covered code.
Name two quality practices beyond tests and what each catches.
Show worked solution
Strong answers pick from readability (maintainable code for the next human), code review (design flaws / unclear code / missed cases), linting (style + likely mistakes), and measuring performance (the real bottleneck), explaining what each addresses.