LangChain / LlamaIndex interview questions

33 questions from the LangChain / LlamaIndex course, each with the correct answer and an explanation. Try to answer before you open the answer.

The Framework Landscape

1. What do LLM frameworks mainly provide?

  1. Free GPUs
  2. A new language model
  3. Reusable building blocks and common interfaces for prompts, retrieval, tools and models
  4. A replacement for Python
Show answer

Answer: Reusable building blocks and common interfaces for prompts, retrieval, tools and models

They standardise common plumbing around the model.

Lesson: Why Use an LLM Framework

2. What does langchain-core contain?

  1. Base interfaces such as runnables, prompts, messages, parsers and tools
  2. Every provider integration
  3. A trained model
  4. The LangSmith service
Show answer

Answer: Base interfaces such as runnables, prompts, messages, parsers and tools

Core holds the shared abstractions; integrations live in separate packages.

Lesson: LangChain, LlamaIndex and Their Packages

3. Which is LlamaIndex strongest at?

  1. Managing GPUs
  2. Training base models
  3. Rendering web pages
  4. Loading, indexing and querying your own data
Show answer

Answer: Loading, indexing and querying your own data

Its abstractions are built around documents, nodes, indexes and query engines.

Lesson: LangChain vs LlamaIndex: Which to Use When

4. Why think about each step's input and output types?

  1. It makes the model smaller
  2. It lets you swap, test and debug steps independently
  3. It removes the need for prompts
  4. It speeds up the GPU
Show answer

Answer: It lets you swap, test and debug steps independently

Clear interfaces make pipelines modular and testable.

Lesson: A Mental Model: Everything Is a Pipeline of Typed Steps

LangChain Core: Prompts, Models and Chains

5. What is an advantage of prompt templates?

  1. They make the model free
  2. Reusable prompts that fail early when a variable is missing
  3. They hide the prompt from the model
  4. They replace parsers
Show answer

Answer: Reusable prompts that fail early when a variable is missing

Templates give structure and validation to prompt building.

Lesson: Prompt Templates and Messages

6. What does the | operator do in LCEL?

  1. Starts a server
  2. Performs a bitwise OR on strings
  3. Deletes a step
  4. Connects runnables so each output feeds the next step
Show answer

Answer: Connects runnables so each output feeds the next step

It composes runnables into a RunnableSequence.

Lesson: Chat Models and the Pipe (LCEL) Chain

7. What does RunnableParallel return?

  1. A dict of the results of each branch run on the same input
  2. Only the first result
  3. Nothing
  4. A trained model
Show answer

Answer: A dict of the results of each branch run on the same input

Each key holds the output of one branch.

Lesson: Runnables: Lambda, Parallel, Passthrough and Batch

8. What happens when the reply breaks the Pydantic schema?

  1. The model is retrained
  2. The bad value is silently accepted
  3. The parser raises an exception you can catch and retry
  4. The program ends without error
Show answer

Answer: The parser raises an exception you can catch and retry

Failing loudly lets you handle bad output explicitly.

Lesson: Output Parsers and Structured Output

9. What does streaming improve?

  1. The vocabulary size
  2. The model's accuracy
  3. Perceived latency: users see text sooner
  4. The training data
Show answer

Answer: Perceived latency: users see text sooner

Streaming shows partial output immediately.

Lesson: Streaming and Async

LangChain: Tools, Routing and Reliability

10. Where does the @tool decorator get the tool description from?

  1. The function's docstring
  2. The file name
  3. A random string
  4. The GPU
Show answer

Answer: The function's docstring

The docstring becomes the description the model reads.

Lesson: Defining Tools

11. What should a RunnableBranch always have?

  1. A trained model
  2. Exactly one condition
  3. A GPU
  4. A default branch for inputs that match no condition
Show answer

Answer: A default branch for inputs that match no condition

Without a default, unexpected inputs have nowhere to go.

Lesson: Routing and Branching

12. When should you NOT blindly retry a step?

  1. When it is a pure function
  2. When it has side effects such as sending an email
  3. When it is a read-only lookup
  4. When it is fast
Show answer

Answer: When it has side effects such as sending an email

Repeating a side-effecting step can duplicate its effect.

Lesson: Retries, Fallbacks and Timeouts

13. What do callbacks receive?

  1. The model weights
  2. Events such as chain start/end, model calls and errors
  3. The user's password
  4. The GPU temperature only
Show answer

Answer: Events such as chain start/end, model calls and errors

Callbacks observe the lifecycle of runs for logging and tracing.

Lesson: Callbacks, Tracing and Debugging

14. Why key chat histories by session ID?

  1. To shorten prompts only
  2. To speed up tokens
  3. To train the model
  4. So users never see each other's conversations
Show answer

Answer: So users never see each other's conversations

Session isolation prevents data leaking between users.

Lesson: Chat History and Memory

Retrieval with LangChain

15. What is chunk overlap for?

  1. Keeping context across chunk boundaries
  2. Doubling the cost
  3. Encrypting text
  4. Deleting duplicates
Show answer

Answer: Keeping context across chunk boundaries

Repeating a little text at boundaries avoids cutting an idea in half.

Lesson: Documents, Loaders and Text Splitters

16. What is a retriever?

  1. A prompt template
  2. A type of GPU
  3. A runnable that takes a query and returns relevant Documents
  4. A model weight file
Show answer

Answer: A runnable that takes a query and returns relevant Documents

Retrievers hide the search backend behind a simple interface.

Lesson: Embeddings, Vector Stores and Retrievers

17. What two things does the RAG prompt receive?

  1. Two models
  2. A GPU and a CPU
  3. Retrieved context and the original question
  4. Only the answer
Show answer

Answer: Retrieved context and the original question

The model needs both evidence and the question to answer faithfully.

Lesson: Building a RAG Chain

18. What does MMR add to retrieval?

  1. More diverse results by reducing near-duplicates
  2. Faster GPUs
  3. Free embeddings
  4. Automatic fine-tuning
Show answer

Answer: More diverse results by reducing near-duplicates

Maximal marginal relevance balances relevance with diversity.

Lesson: Making Retrieval Better: Filters, MMR, Reranking

LlamaIndex: Data, Indexes and Query Engines

19. What does a Node represent in LlamaIndex?

  1. A prompt template
  2. A server in a cluster
  3. A GPU core
  4. A chunk of a Document, with metadata and relationships
Show answer

Answer: A chunk of a Document, with metadata and relationships

Nodes are the retrievable units produced from Documents.

Lesson: LlamaIndex Data Model: Documents and Nodes

20. What does a retriever's result include besides the node text?

  1. A GPU temperature
  2. A similarity score
  3. A password
  4. A new model
Show answer

Answer: A similarity score

NodeWithScore pairs each node with how well it matched.

Lesson: Building a Vector Index and Retriever

21. Why does the Response include source_nodes?

  1. To train the LLM
  2. So you can show which passages supported the answer
  3. To compress the index
  4. To remove citations
Show answer

Answer: So you can show which passages supported the answer

Source nodes enable citations and debugging.

Lesson: Query Engines and Response Synthesis

22. Why persist an index?

  1. To remove the retriever
  2. To make queries wrong
  3. To hide metadata
  4. To avoid paying to re-embed the corpus at every start
Show answer

Answer: To avoid paying to re-embed the corpus at every start

Embedding is the expensive step, so reuse its result.

Lesson: Persisting and Reloading an Index

Agents and Workflows

23. What must every agent loop have?

  1. A maximum number of iterations and a budget
  2. An unlimited number of retries
  3. No logging
  4. Admin access to everything
Show answer

Answer: A maximum number of iterations and a budget

Limits prevent runaway cost and endless loops.

Lesson: Agents: The Tool-Calling Loop

24. What does checkpointing enable?

  1. Hiding prompts
  2. Training a model
  3. Saving and resuming state, for memory and fault recovery
  4. Removing nodes
Show answer

Answer: Saving and resuming state, for memory and fault recovery

Checkpoints persist graph state between steps and runs.

Lesson: LangGraph: Stateful Workflows

25. Which action most clearly needs human approval?

  1. Formatting a date
  2. Reading a public FAQ
  3. Issuing a customer refund
  4. Counting words
Show answer

Answer: Issuing a customer refund

Irreversible financial actions deserve a human check.

Lesson: Guardrails for Agentic Apps

Testing, Evaluating and Shipping

26. Why use fake models in unit tests?

  1. Tests become fast, free and repeatable
  2. They improve model quality
  3. They remove the need for code
  4. They train the embeddings
Show answer

Answer: Tests become fast, free and repeatable

Fixed outputs make assertions on your own logic reliable.

Lesson: Unit Testing with Fake Models

27. Why link each evaluation score to a trace?

  1. To avoid metrics
  2. To hide failures
  3. To remove datasets
  4. To inspect retrieved chunks, the prompt and the reply for failing cases
Show answer

Answer: To inspect retrieved chunks, the prompt and the reply for failing cases

A score says that something failed; a trace shows why.

Lesson: Evaluating Quality: Datasets, Metrics, Tracing

28. Why pin library versions?

  1. Pinning makes the model smarter
  2. These libraries change quickly and upgrades can break code
  3. It is required by Python
  4. It reduces token cost
Show answer

Answer: These libraries change quickly and upgrades can break code

Stable versions make behaviour reproducible until you choose to upgrade.

Lesson: Versions, Cost, Latency and Security

29. When is a direct provider SDK often enough?

  1. A complex multi-agent workflow
  2. A single prompt and one model call with no retrieval or tools
  3. Indexing millions of documents
  4. Never
Show answer

Answer: A single prompt and one model call with no retrieval or tools

Simple apps do not need extra abstractions.

Lesson: When to Drop the Framework

Putting It Together

30. Why does the design give the agent only read-only tools?

  1. To avoid citations
  2. Read-only tools are faster
  3. Write tools do not exist
  4. To limit harm if the model is tricked by injected text
Show answer

Answer: To limit harm if the model is tricked by injected text

Least privilege bounds what a compromised agent can do.

Lesson: Case Study: A Documentation Assistant

31. Your chain's JSON parsing sometimes fails because the model adds extra text. What is the most robust fix?

  1. Use native structured output or a Pydantic parser, validate, and retry on failure
  2. Ignore the errors
  3. Increase chunk size
  4. Remove the parser
Show answer

Answer: Use native structured output or a Pydantic parser, validate, and retry on failure

Constrained output plus validation and retry handles stray text.

Lesson: Revision: Cheat Sheet and Self-Check

32. Which stage of a RAG app most often explains a wrong answer?

  1. The Python version string
  2. The font of the UI
  3. Retrieval did not return the relevant passage
  4. The length of the repo name
Show answer

Answer: Retrieval did not return the relevant passage

If the evidence is missing from the prompt, the model cannot use it.

Lesson: Revision: Cheat Sheet and Self-Check

33. What should an agent loop always include?

  1. Write access to every system
  2. Unlimited iterations
  3. Step and budget limits, argument validation and logging of tool calls
  4. No tests
Show answer

Answer: Step and budget limits, argument validation and logging of tool calls

Limits, validation and logs keep autonomous loops safe and debuggable.

Lesson: Revision: Cheat Sheet and Self-Check

← Back to the course