Add interview questions
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b51d29bdb5
commit
cbe3b10442
1 file changed
+44
@@ -0,0 +1,44 @@
|
||||
# Interview Questions
|
||||
|
||||
## Before coding
|
||||
|
||||
1. Walk me through the code. What does each file do, and how does a trade move through the system?
|
||||
2. Which assumptions would you check with me before you touch anything?
|
||||
3. CI is green but the ticket says the code is broken. What does that tell you, and where do you look first?
|
||||
4. How would you reproduce the ticket? Can you do it with a smaller input than `main.py` uses?
|
||||
|
||||
## Logger
|
||||
|
||||
5. The logs show "no errors". How would you prove whether an error really did not happen or it happened and was not logged?
|
||||
6. The log lines don't match their trades. Why could the context be correct when you log but wrong when the line is written?
|
||||
7. Why might someone buffer log records? What are the risks?
|
||||
8. How does Python's standard `logging` module avoid the same problems? Name the specific mechanisms.
|
||||
9. Would you replace this logger with `logging`? What would that cost, and what would you gain?
|
||||
10. How would you test a logger whose output contains a timestamp?
|
||||
|
||||
## State and data model
|
||||
|
||||
11. Who owns a `Trade` once it is passed to `Ledger.apply`? How would you enforce that in the code?
|
||||
12. Name two or more ways to stop callers from changing a `Trade`. What does each one cost?
|
||||
13. The EOD rebuild swallows `ValueError`. Is that the right policy? What would you change?
|
||||
14. Why did the existing rebuild test still pass?
|
||||
|
||||
## Positions and P&L
|
||||
|
||||
15. Work this out by hand: buy 100 @ 100, then sell 150 @ 105. What are `qty`, `avg_price`, and `realized`?
|
||||
16. Which edge cases of `Position.update` would you test? Think about zero, flips, shorts, and adding to a short.
|
||||
17. Should prices use `float`? What would you use in production, and why?
|
||||
|
||||
## Tests
|
||||
|
||||
18. Which existing tests could never fail? Explain why each one passes.
|
||||
19. How do you show that a new test really detects a bug?
|
||||
20. Would property-based testing help here? What property would you check?
|
||||
21. What would you add to CI so that weak tests like these get caught?
|
||||
|
||||
## Wrap-up
|
||||
|
||||
22. If you could ship only one fix today, which one would you pick, and why?
|
||||
23. What would you add so Ops can answer this kind of ticket without engineering?
|
||||
24. How did you check the AI's suggestions? Where was it wrong, or where did it not help?
|
||||
25. In production, how would you find positions that were already corrupted by these bugs?
|
||||
Reference in new issue
Block a user