AI Infra Interviews logo
Practice tests · 30 questions

Coding for Infra: the practice test

Practical builds in Python, Go and C++: a GPU credit scheduler, a rate limiter, a versioned KV store, merging GPU idle intervals, a batching queue, retry with backoff, concurrency under load, parsing a kernel trace. The screens that test whether you can ship infra code in 45 minutes. This test drills exactly that: 10 easy, 10 medium and 10 hard questions, every one explained, every explanation linking into the worked material.

Set up your test
Topic
How confident are you feeling?
Questions
10 in this pool · about 7 min
Reveal answers
Sign in to startFree account · your questions rotate between takes

Sample questions, answered

easy · sample
In the credit-based job scheduler problem, when should an account's credits be charged?
At submission, because it is the simplest bookkeeping and a failed job can always be refunded by hand later
Reserve at submit, settle at completion
At completion only, so accounts can submit as many jobs as they like
Never; credits are advisory

Charging at submit makes failures unfair; charging at completion lets an account overcommit by submitting many jobs it cannot pay for. Reserving the cost at submit and settling at completion keeps the invariant balance ≥ reserved ≥ 0, so an account never runs jobs it cannot pay for even with many pending, and a failed job releases its reservation without charging. Stating that invariant after every change is what the interviewer is listening for.

easy · sample
How should a token bucket refill, and which clock should it use?
A background thread adds tokens every millisecond, using wall-clock time so that the refill matches the server logs
Once per minute in a batch, using the system clock
Lazily, from elapsed monotonic time: tokens = min(capacity, tokens + rate × Δt)
It should not refill; the bucket is reset by the operator

A timer thread per key drifts and does not scale; wall-clock time jumps on NTP adjustments. Computing the refill from the monotonic time elapsed since the last request is O(1), thread-free and exact, and injecting the clock makes the class testable without sleeping. The bucket then allows a burst of capacity after idle and a sustained rate of tokens per second, and a denied request can be told exactly how long to wait: (n − tokens) ÷ rate.

Go deeper than the quiz

A practice test measures recall. The material it draws from teaches the reasoning: