Skip to content
Preptima

Context & Tokenisation interview questions

Tokens versus characters, context-window budgeting, truncation and compaction strategies, prompt caching, and how long context degrades.

3 questions in Generative AI & Large Language Models.

medium2

mediumScenarioDesign

Before we build this, how do you estimate what the LLM feature will cost to run?

Write down requests per day, input tokens per request and expected output tokens, multiply by the provider's per-million rates, then test each assumption. Output tokens cost several times input, retries and agent loops multiply the input, and a cached prefix rewrites the arithmetic.

5 minmid, senior, staff

hard1

hardDesignScenario

How would you budget the context window for a chat feature backed by retrieval?

Subtract the answer reservation and the fixed prompt first, give retrieval a token allowance rather than a passage count, and let conversation history have what remains under an explicit eviction policy - because history is the only term that grows every turn while everything else stays flat.

5 minmid, senior, staff