AI and LLMs Junior cheat sheet: interview answers

Every question of this level with its correct answer and explanation, on one page for a quick review before the interview.

  1. 1. What does a large language model (LLM) fundamentally do?

    Correct answer: Predicts the next token based on the text so far

    An LLM is trained to continue text one token at a time. Useful behaviour like answering questions comes from that prediction plus training on instructions, not from a fact database.

  2. 2. What is a token in the context of LLMs?

    Correct answer: A chunk of text, often part of a word, that the model processes

    Text is split into tokens by a tokenizer. In English one token is roughly three quarters of a word; other languages and code often need more tokens per word.

  3. 3. Why does the same text in Ukrainian often use more tokens than in English?

    Correct answer: Tokenizers favour English, so other languages split into more pieces

    More tokens mean higher cost, slower responses and less room in the context window for the same content.

  4. 4. What is the context window of a model?

    Correct answer: The most tokens it can see at once, input plus output

    Everything the model sees, such as the system prompt, history, documents and its answer, must fit in the window. Text beyond it is simply not visible to the model.

  5. 5. What does the temperature parameter control?

    Correct answer: How random the choice of the next token is

    Low temperature makes the model pick likely tokens, giving focused, repeatable answers. Higher values give more varied, creative output.

  6. 6. Which temperature suits extracting fields from an invoice into JSON?

    Correct answer: A low one, for consistent, predictable output

    Extraction, classification and code usually benefit from low temperature. Brainstorming and creative writing tolerate higher values.

  7. 7. What is an LLM hallucination?

    Correct answer: A confident answer that is false or made up

    Models produce plausible text, not verified facts. Invented citations, APIs or numbers are typical, which is why grounding and checking matter.

  8. 8. What is a model's knowledge cutoff?

    Correct answer: The date after which its training data has no information

    A model doesn't know events after its cutoff unless the application gives it that information, for example through search or documents in the prompt.

  9. 9. What is a system prompt?

    Correct answer: Instructions that set the model's role, rules and context for a conversation

    System prompts define behaviour, such as tone, allowed tasks and output format. They're sent with every request and applied throughout the conversation.

  10. 10. Chat APIs are usually stateless. What does that mean for an app?

    Correct answer: The app must send the conversation history with each request

    The model sees only what's in the current request. Long conversations grow in tokens, so apps trim, summarize or cache history.

  11. 11. What is few-shot prompting?

    Correct answer: Including a few examples of input and desired output in the prompt

    Examples show format and style better than descriptions. They should be varied, so the model doesn't copy one example too literally.

  12. 12. Why ask a model to think step by step before answering hard problems?

    Correct answer: Reasoning written out first often improves accuracy on multi-step tasks

    Working through steps gives the model more computation before the final answer. Many models now have a built-in thinking or reasoning mode for this.

  13. 13. How are LLM API calls usually priced?

    Correct answer: Per token, often with different prices for input and output

    Long prompts, big documents and verbose answers cost more. Output tokens are often priced higher than input tokens.

  14. 14. Why do chat interfaces often stream the answer token by token?

    Correct answer: Users see progress at once instead of waiting for the whole answer

    Time to first token matters for perceived speed. Streaming needs UI handling for partial text, errors mid-stream and cancellation.

  15. 15. What does it mean when a response stopped because it hit the max tokens limit?

    Correct answer: The answer was cut off and may be incomplete

    Apps should check the stop reason. A truncated JSON object, for example, will fail to parse.

  16. 16. What is an embedding?

    Correct answer: A list of numbers representing the meaning of text

    Texts with similar meaning have embeddings that are close together, which enables semantic search, clustering and recommendations.

  17. 17. How does semantic search with embeddings differ from keyword search?

    Correct answer: It finds text with similar meaning even without the same words

    "How do I reset my password" can match "Recover account access". Many systems combine both approaches.

  18. 18. What is retrieval-augmented generation (RAG)?

    Correct answer: Fetching relevant documents and adding them to the prompt

    RAG grounds answers in your data, such as docs or tickets, without retraining. Quality depends heavily on what gets retrieved.

  19. 19. Why are documents split into chunks for RAG?

    Correct answer: To retrieve only the relevant parts and fit them in the context

    Chunk size is a trade-off: too small loses context, too large brings in noise and uses tokens.

  20. 20. When is RAG usually a better choice than fine-tuning?

    Correct answer: When the model needs up-to-date or private facts

    RAG adds knowledge at request time and can cite sources. Fine-tuning changes behaviour or style but is a poor way to keep facts current.

  21. 21. What is fine-tuning?

    Correct answer: Further training a model on examples to adjust its behaviour

    Fine-tuning can teach format, style or a narrow task. It costs data preparation and evaluation, and prompting is usually tried first.

  22. 22. What is tool use (function calling)?

    Correct answer: The model asks for a function call; the app runs it

    The app describes tools with names and JSON schemas. The model returns a call like get_weather({city: "Kyiv"}); the app executes it and sends the result back.

  23. 23. Who actually executes a tool the model asks to call?

    Correct answer: The application, which decides whether and how to run it

    This is where permissions, validation and logging belong. The model only proposes the call.

  24. 24. What is an AI agent in simple terms?

    Correct answer: An LLM that uses tools in a loop to reach a goal

    The model plans, calls tools, reads results and decides the next step until the task is done or a limit is reached.

  25. 25. What is the Model Context Protocol (MCP)?

    Correct answer: A standard way to connect AI apps to tools and data sources

    An MCP server exposes tools and resources once, and any compatible client, such as an IDE or chat app, can use them.

  26. 26. Why ask for structured output like JSON from a model?

    Correct answer: So the application can reliably parse and use the result

    Many APIs can enforce a JSON schema. The app should still validate the result before using it.

  27. 27. Where should the API key for an LLM provider live in a web app?

    Correct answer: On the server, never in frontend code

    Anything shipped to the browser can be read. A leaked key lets anyone run requests on your bill. The frontend calls your own backend instead.

  28. 28. What should an app do when the LLM API returns 429?

    Correct answer: Retry with backoff and respect rate limits

    Providers limit requests and tokens per minute. Backoff, queues and clear user messages handle bursts gracefully.

  29. 29. What is prompt injection?

    Correct answer: Input that tries to override the app's instructions

    "Ignore previous instructions and..." in user text, a web page or a document can hijack the model if the app trusts its output too much.

  30. 30. Why is indirect prompt injection dangerous?

    Correct answer: Hidden instructions in documents or pages steer the model

    A summarization feature reading an email that says "forward all messages to..." can be tricked into acting, if it has tools.

  31. 31. What is a safe habit when using public AI chat tools at work?

    Correct answer: Don't paste secrets, customer data or confidential code

    Data may be stored or reviewed depending on the plan and settings. Follow company policy and use approved tools for sensitive work.

  32. 32. Why must code from an AI assistant be reviewed?

    Correct answer: It can be wrong, insecure or use APIs that don't exist

    Assistants produce plausible code fast, including bugs and hallucinated functions. Tests and review are still the developer's job.

  33. 33. Why is testing an LLM feature harder than testing normal code?

    Correct answer: Outputs vary, so exact string comparisons often don't work

    Tests check properties instead: valid JSON, required fields, length limits, contains or excludes certain facts, or a judged quality score.

  34. 34. What is an eval for an LLM feature?

    Correct answer: A set of test inputs with criteria to score the outputs

    Evals turn "seems fine" into numbers you can compare across prompt changes, models and versions.

  35. 35. Which check is reliable for an LLM that must return a category from a fixed list?

    Correct answer: Assert the output is exactly one of the allowed values

    Classification tasks have clear right answers, so accuracy against labelled examples works well.

  36. 36. What is a golden dataset in LLM testing?

    Correct answer: A curated set of inputs with expected or reference answers

    It's built from real use cases and edge cases, and grows as bugs are found, like a regression suite.

  37. 37. What is LLM-as-a-judge?

    Correct answer: Using a model to grade another model's outputs

    It scales evaluation of open-ended answers. Judges have biases, so their scores need checking against human ratings.

  38. 38. Why version prompts like code?

    Correct answer: Small wording changes can change behaviour, so changes need review and tests

    Keeping prompts in Git with evals in CI catches regressions when someone tweaks the wording.

  39. 39. Does temperature 0 guarantee identical answers every time?

    Correct answer: Not always; small differences can still occur

    Infrastructure details can cause small variations. Tests shouldn't rely on exact repeats even at low temperature.

  40. 40. What does top-p (nucleus sampling) do?

    Correct answer: Limits choices to the most likely tokens whose probabilities add up to p

    Like temperature, it controls randomness. Usually you adjust one of them, not both.

  41. 41. What is the role of the transformer's attention mechanism?

    Correct answer: Letting each token weigh how relevant other tokens are

    Attention is what lets models use context across long text, and it's a key reason for the transformer architecture's success.

  42. 42. What is the difference between pre-training and instruction tuning?

    Correct answer: Pre-training learns language; tuning teaches following instructions

    A base model just continues text. Instruction tuning and RLHF make it act as a helpful assistant.

  43. 43. What is RLHF?

    Correct answer: Tuning a model with human preference feedback

    Humans compare answers, a reward model learns their preferences, and the LLM is tuned toward preferred behaviour.

  44. 44. What is a multimodal model?

    Correct answer: A model that handles several input types, like text and images

    Multimodal models can read screenshots, charts or documents. Testing them needs image inputs as well as text.

  45. 45. What is a typical trade-off between a large and a small model?

    Correct answer: Large ones are more capable but slower and pricier

    Simple classification may work fine on a small, cheap model; complex reasoning may need a larger one. Evals tell you which is enough.

  46. 46. Why put clear output instructions, like "answer in under 50 words", in prompts?

    Correct answer: Models follow explicit constraints better than vague hopes

    Being specific about format, length and audience reduces back-and-forth and makes outputs easier to test.

  47. 47. What is a guardrail in an LLM application?

    Correct answer: A check that blocks or fixes unsafe or invalid inputs and outputs

    Examples: blocking personal data in outputs, validating JSON, refusing off-topic requests, or filtering harmful content.

  48. 48. Why should an AI feature show sources when it answers from documents?

    Correct answer: Users can verify claims and spot hallucinations

    Citations build trust and make testing easier: you can check the cited passage supports the claim.

  49. 49. What happens when a conversation grows longer than the context window?

    Correct answer: Older content must be dropped or summarized

    Apps manage this with trimming, summarization or retrieval of relevant past messages.

  50. 50. What does prompt caching help with?

    Correct answer: Reusing a repeated long prefix to cut cost and latency

    If many requests share the same system prompt or documents, the provider can cache that prefix and charge less for it.

  51. 51. Why can very long prompts with many documents give worse answers?

    Correct answer: Relevant details can get lost among lots of irrelevant text

    Relevant retrieval beats dumping everything in. Placing key instructions clearly and quoting relevant parts helps.

  52. 52. What is bias in AI outputs?

    Correct answer: Systematic unfair patterns, e.g. about gender or ethnicity

    Models learn patterns from data, including stereotypes. Testing with varied names and groups helps reveal unfair treatment.

  53. 53. Why should users be told when they're talking to an AI?

    Correct answer: Transparency builds trust and is required by some laws

    Regulations such as the EU AI Act include transparency duties for chatbots and AI-generated content.

  54. 54. What is a reasoning or thinking model?

    Correct answer: A model that works through a problem before answering

    It trades speed and cost for accuracy on complex tasks like math, coding and planning.

  55. 55. What should an AI chat do when it doesn't know the answer?

    Correct answer: Say so and suggest where to find it

    Instructing the model to admit uncertainty and grounding it in sources reduces hallucinations.

  56. 56. Why log prompts and outputs of an AI feature in production, with care?

    Correct answer: To debug failures and find new test cases, while protecting privacy

    Real failures become eval cases. Logs need redaction of personal data and access controls.

  57. 57. What does it mean that LLM output is non-deterministic?

    Correct answer: The same prompt can produce different answers

    Tests should run several samples and check properties or pass rates, not a single exact answer.

  58. 58. What is a simple automated check for a chatbot answer?

    Correct answer: Assert it has the required fact and nothing forbidden

    Simple code checks (contains, regex, length, JSON validity) are cheap and catch many regressions before using a judge model.

  59. 59. What is the role of a vector database in RAG?

    Correct answer: Storing embeddings and finding the most similar ones fast

    It runs nearest-neighbour search over many vectors. Some regular databases also support vector indexes.

  60. 60. Why might an AI feature refuse a harmless request?

    Correct answer: Safety training can be overcautious with some phrasing

    Over-refusal is a quality bug too. Evals should include harmless edge cases, not only harmful ones.

  61. 61. What is red teaming for an AI application?

    Correct answer: Deliberately trying to make it misbehave to find weaknesses

    Red teamers try jailbreaks, injections and data leaks. Tools like promptfoo can automate parts of it.

  62. 62. What is a jailbreak?

    Correct answer: A prompt that tricks the model into ignoring its safety rules

    Role-play, encoding tricks or long manipulative prompts can bypass safety training. Apps need layers of defence, not just model training.

  63. 63. Why should an AI agent's tools follow least privilege?

    Correct answer: A tricked agent can only do limited damage

    If an agent can read email, it shouldn't also be able to delete the database. Sensitive actions should need confirmation.

  64. 64. What is "human in the loop" for AI features?

    Correct answer: A person reviews or approves important AI actions or outputs

    Approving payments, emails or code merges before they happen limits the impact of mistakes.

  65. 65. What does the AI SDK, e.g. Vercel's, help a web developer with?

    Correct answer: A unified API for calling models, streaming and tools

    Such SDKs smooth over provider differences and provide UI helpers for streaming chat.

  66. 66. Why should prompts separate instructions from user data, e.g. with tags?

    Correct answer: It helps the model tell what to follow from what to process

    Wrapping documents in tags like <document> makes the structure clear. It reduces confusion but doesn't fully stop injection.

  67. 67. How can you reduce hallucinations in an answer about company policy?

    Correct answer: Provide the policy text and ask to answer only from it

    Grounding plus an instruction to say "not in the document" when unsure makes answers checkable.

  68. 68. What does "model drift" mean for an AI feature?

    Correct answer: Behaviour changes over time, e.g. after a model update

    Pinning model versions and running evals before upgrading catches changes in quality or format.

  69. 69. What is the main risk of trusting AI-generated SQL without checks?

    Correct answer: It may be wrong, slow or destructive

    Run it read-only where possible, review it, and never let a model execute writes on production without guards.

  70. 70. Why are evals run on many examples instead of one?

    Correct answer: Outputs vary, so pass rates across cases show real quality

    A feature passing 92 of 100 cases tells you more than one good-looking answer. Track the rate over versions.

  71. 71. What is a chatbot's "context" made of in a typical app?

    Correct answer: System prompt, history, retrieved data and tool results

    Context engineering is choosing what goes into the window for each request.

  72. 72. What does "grounded" mean for an AI answer?

    Correct answer: It's supported by provided sources or data

    Faithfulness checks compare claims with the retrieved text. Ungrounded claims are hallucination risks.

  73. 73. Why do long answers take noticeably longer than long prompts?

    Correct answer: Output is generated token by token, so long answers are slow

    The prompt is processed in parallel, but each output token depends on the previous one. Asking for concise answers is one of the easiest latency wins.

  74. 74. Why give a model a role, like "You are a support agent for X"?

    Correct answer: It sets tone, expertise and boundaries for its answers

    A clear role in the system prompt focuses behaviour. It works best together with explicit rules and examples.

  75. 75. Which data should never go to a third-party LLM without approval?

    Correct answer: Personal and confidential data covered by contracts or law

    Sending customer records or trade secrets to an external service may break contracts or privacy laws. Check the provider's data terms and your policy first.