Files
inter-ans/INTERVIEW_QUESTIONS.md
2026-10-31 08:55:38 -04:00

2.3 KiB

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

  1. The logs show "no errors". How would you prove whether an error really did not happen or it happened and was not logged?
  2. The log lines don't match their trades. Why could the context be correct when you log but wrong when the line is written?
  3. Why might someone buffer log records? What are the risks?
  4. How does Python's standard logging module avoid the same problems? Name the specific mechanisms.
  5. Would you replace this logger with logging? What would that cost, and what would you gain?
  6. How would you test a logger whose output contains a timestamp?

State and data model

  1. Who owns a Trade once it is passed to Ledger.apply? How would you enforce that in the code?
  2. Name two or more ways to stop callers from changing a Trade. What does each one cost?
  3. The EOD rebuild swallows ValueError. Is that the right policy? What would you change?
  4. Why did the existing rebuild test still pass?

Positions and P&L

  1. Work this out by hand: buy 100 @ 100, then sell 150 @ 105. What are qty, avg_price, and realized?
  2. Which edge cases of Position.update would you test? Think about zero, flips, shorts, and adding to a short.
  3. Should prices use float? What would you use in production, and why?

Tests

  1. Which existing tests could never fail? Explain why each one passes.
  2. How do you show that a new test really detects a bug?
  3. Would property-based testing help here? What property would you check?
  4. What would you add to CI so that weak tests like these get caught?

Wrap-up

  1. If you could ship only one fix today, which one would you pick, and why?
  2. What would you add so Ops can answer this kind of ticket without engineering?
  3. How did you check the AI's suggestions? Where was it wrong, or where did it not help?
  4. In production, how would you find positions that were already corrupted by these bugs?