learn deep. ship safe.Practice testsFollow ByteMunSubscribe
Generative AI · Mid-level

Intermediate Generative AI Interview Questions

12 generative AI interview questions for developers with some experience: AI agents, MCP, hybrid search, rerankers, LoRA, RAG versus fine-tuning, tool calling, prompt injection, structured outputs and RAG evaluation. Each answer explains why the other options are wrong.

CoversAgentsEvaluationFine-tuningLLM basicsPrompt injectionRAGRetrievalSafetyTool calling

Practice questions with answers

Tap an option: green is right, red is wrong, and the explanation says why.

0/10 answered · ✓ 0 ✗ 0
Question 1 of 101 / 10
Q1Choose one answereasy

In LLM applications, what is an AI agent?

Show answer and explanation

Answer: D. An LLM running in a loop that decides which tools to call, looks at the results and continues until the goal is met

The working definition interviewers expect: an agent is a model in a loop. It reads the goal, chooses an action (often a tool call such as search, a database query or code execution), observes the result, and decides the next step until it can answer or hits a limit. A single prompt-and-reply chatbot isn't an agent, however it is branded, training data doesn't make something an agent, and a human reviewer is a guardrail, not the agent.

Q2Choose one answereasy

What problem does the Model Context Protocol (MCP) solve?

Show answer and explanation

Answer: D. It gives AI applications one standard way to connect to tools and data sources, instead of a custom integration for each pair

MCP is an open protocol for connecting AI applications to external tools and data. A tool or data source is exposed once as an MCP server (files, a database, a ticketing system), and any MCP-compatible client can discover and use its tools and resources. That replaces many one-off integrations with one standard interface. It doesn't compress prompts, isn't a model architecture, and isn't an encryption layer, although servers still need proper authentication and least-privilege access.

Q3Choose one answermedium

What does hybrid search usually mean in a RAG system?

Show answer and explanation

Answer: C. Combining keyword search (such as BM25) with vector search and merging the two result lists

Vector search is good at meaning ("cancel my plan" matches "how to end a subscription") but weak on exact terms such as error codes, product names and IDs, where keyword search like BM25 shines. Hybrid search runs both and merges the rankings, often with reciprocal rank fusion, so you get the strengths of each. It isn't about using two vector stores, two kinds of hardware, or two models.

Q4Choose one answermedium

In a RAG pipeline, what does a reranker do?

Show answer and explanation

Answer: B. It scores each query and candidate passage pair together and reorders the top results by relevance

First-stage retrieval compares vectors computed separately for the query and each passage, which is fast but coarse. A reranker, typically a cross-encoder, reads the query and one passage together and outputs a relevance score, which is far more accurate. Because that is slower, it is applied only to the top candidates (say 50), and the best few go into the prompt. It doesn't sort by date, generate the answer, or clean the query.

Q5Choose one answermedium

What is LoRA (low-rank adaptation)?

Show answer and explanation

Answer: B. A fine-tuning method that trains small low-rank matrices added to frozen model weights, using far less memory

Full fine-tuning updates every weight, which needs a lot of GPU memory. LoRA freezes the original weights and learns, for selected layers, two small matrices whose product is a low-rank update added to the frozen weight. Only those few parameters are trained and stored, so adapters are small, cheap to train and can be swapped per task. It doesn't prune layers, isn't a retrieval method, and isn't quantization (though QLoRA combines LoRA with a quantized base model).

Q6Choose one answermedium

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

Show answer and explanation

Answer: A. When the knowledge changes often or answers must cite your own documents

RAG keeps knowledge outside the model: update a document and the next answer uses it, and every answer can point to its source. Fine-tuning bakes behaviour into weights, which suits a consistent style, format or task skill, not facts that change weekly. With only example conversations and no documents there is nothing to retrieve, so fine-tuning or prompting fits better, and neither approach makes a model smaller (that is distillation or quantization).

Q7Choose one answermedium

How does tool (function) calling work with an LLM API?

Show answer and explanation

Answer: C. The model returns a structured request naming a tool and its JSON arguments; your code runs the tool and sends the result back

You describe the available tools (name, purpose, JSON schema of arguments) in the request. When a tool would help, the model replies with a tool call instead of text, for example get_weather({"city": "Pune"}). Your application validates the arguments, runs the real function, and sends the result back so the model can continue. The model never executes anything itself, has no network access of its own, and nothing is being trained.

Q8Select all that applymedium

Which of these help defend an LLM app against prompt injection? Select all that apply.

Show answer and explanation

Answer: B. Give tools the least privilege needed and require confirmation for risky actions + C. Treat retrieved documents and web pages as data, clearly separated from your instructions + D. Validate or filter the model's output before acting on it

Prompt injection is text that tries to override your instructions, often hidden in a page or email the model reads. No single fix exists, so you layer defences: mark untrusted content as data, limit what tools can do and ask a human before sending money or emails, and check outputs (for example against an allow-list) before acting. Obeying instructions found in content is exactly the vulnerability, and secrets in a prompt can be extracted by an injection.

Q9Choose one answerhard

Why can RAG still be worth it with a model that has a very long context window?

Show answer and explanation

Answer: D. Cost and latency grow with every token, and models can miss facts buried in very long contexts

Putting everything into a huge prompt is simple but expensive: you pay for and wait on every input token on every request. Studies also show models use information at the start and end of long inputs better than the middle, so a key fact can be overlooked. Retrieving the few relevant passages keeps prompts small, fast and focused. PDFs become plain text either way, RAG doesn't change the window, and long-context models do follow system prompts.

Q10Choose one answerhard

You're evaluating a RAG assistant. Which pair of checks tells retrieval problems apart from generation problems?

Show answer and explanation

Answer: B. Retrieval recall (did the right passage come back?) and answer faithfulness (does the answer stick to the retrieved text?)

A wrong answer has two possible causes: the right passage never reached the prompt, or it did and the model ignored or distorted it. Measuring retrieval recall at k on a labelled question set isolates the first; scoring faithfulness or groundedness (is every claim supported by the provided context?) isolates the second. BLEU and ImageNet are unrelated benchmarks, speed and hardware metrics measure performance not quality, and index size or chunk size are settings, not outcomes.

Take it as a timed test

  • 12 questions
  • 15 min
  • Pass mark 60%
  • Answers shown at the end

Sign in with your email to take the test: we send a 6-digit code, no password. Your scores and reports are saved to your account. The test also uses 10 questions that aren't shown above, so practise for understanding, not memory.

About this paper

This intermediate paper has 12 generative AI questions for developers who have built, or are about to build, an LLM feature: a RAG chatbot, a document assistant or an agent that calls tools. It focuses on the decisions you make while building: what an agent is, how MCP connects tools, how to search, when a reranker earns its latency, when to fine-tune instead of retrieving, how tool calling actually works and how to keep an assistant safe from prompt injection. Ten questions are on this page with explanations. Each timed test draws 12 questions from a larger bank, including ones that aren't shown here, so every attempt is different.

Interviewers at this level usually follow up with "how would you know it works?", so pay attention to the evaluation question, then take the timed test and read the topic report.

Written by Published Answers checked by Deepak

More Generative AI quizzes

All Generative AI quizzes →