Courseiva

CCNA LangChain and AI Application Development Questions

65 questions · LangChain and AI Application Development · All types, answers revealed

1
MCQhard

An organization uses Oracle AI Vector Search in Oracle Database 23ai to store embeddings for a LangChain RAG application. They need to perform similarity search with high recall and low latency for a large dataset (10M vectors). Which index configuration should they choose?

A.Binary quantization without an index
B.HNSW index with appropriate parameters (e.g., efConstruction=200, M=32)
C.No index, use brute-force distance computation
D.IVF index with 1000 centroids
AnswerB

HNSW provides high recall and low latency, suitable for large datasets.

Why this answer

HNSW (Hierarchical Navigable Small World) indexes provide high recall and low latency for approximate nearest neighbor search, especially on large datasets. IVF (Inverted File) is also an option but typically requires more tuning and may have lower recall at high speed. HNSW is generally preferred for production workloads.

2
MCQeasy

In LangChain, which component is responsible for loading data from a specific file format, such as PDF or CSV, into a document object?

A.Text Splitter
B.Document Loader
C.Vector Store
D.Retriever
AnswerB

Document loaders handle reading files and converting them into LangChain Document objects with content and metadata.

Why this answer

Document Loader is the correct component because it is specifically designed to ingest data from various file formats (e.g., PDF, CSV, HTML) and convert it into LangChain's standardized Document objects. This is the foundational step in any retrieval-augmented generation (RAG) pipeline, where raw data must first be loaded before any splitting, embedding, or retrieval occurs.

Exam trap

The 1Z0-1127 exam often tests the distinction between the loading phase and the processing phase, so the trap here is confusing the role of a Document Loader (input ingestion) with that of a Text Splitter (post-load chunking) or a Retriever (query-time retrieval).

How to eliminate wrong answers

Option A is wrong because Text Splitter is used to chunk large Document objects into smaller segments after loading, not to load data from files. Option C is wrong because Vector Store is a storage and indexing component for embeddings, not a loader for raw file formats. Option D is wrong because Retriever is responsible for fetching relevant documents from a Vector Store or other index based on a query, not for loading data from files.

3
MCQeasy

Which LangChain abstraction is used to wrap OCI Generative AI's chat models (e.g., Cohere Command R) for use in a LangChain chain?

A.OCIGenAI
B.OCIGenAIEmbeddings
C.OracleAIChain
D.ChatOCIGenAI
AnswerD

This is the dedicated chat model wrapper for OCI Generative AI.

Why this answer

LangChain provides ChatOCIGenAI as a wrapper for OCI chat models, similar to ChatOpenAI for OpenAI. This allows seamless integration with LangChain's chat model interface.

4
MCQhard

A company has a collection of PDF documents that are 500 pages each. They want to build a RAG system using LangChain and FAISS. They need to ensure that each chunk has enough context for accurate retrieval while keeping chunk size small enough for efficient embedding. They also want some overlap between chunks to avoid losing context at boundaries. Which text splitter configuration is most appropriate?

A.RecursiveCharacterTextSplitter with chunk_size=5000 and chunk_overlap=0
B.CharacterTextSplitter with chunk_size=2000 and chunk_overlap=500
C.TokenTextSplitter with chunk_size=100 and chunk_overlap=10
D.RecursiveCharacterTextSplitter with chunk_size=1000 and chunk_overlap=200
AnswerD

1000 characters provides good context, 200 overlap (20%) avoids boundary loss.

Why this answer

RecursiveCharacterTextSplitter with a moderate chunk_size (e.g., 1000 characters) and a chunk_overlap of 10-20% is a standard choice for balancing context and efficiency.

5
MCQeasy

In LangChain, which class should be used to wrap Oracle Cloud Infrastructure's Generative AI service as a chat model?

A.OracleVS
B.ChatOCIGenAI
C.OCIGenAIEmbeddings
D.OCIGenAI
AnswerB

ChatOCIGenAI is specifically designed to wrap OCI Generative AI chat endpoints.

Why this answer

ChatOCIGenAI is the LangChain wrapper for chat-based models from OCI Generative AI. OCIGenAI is for LLM (non-chat) completions, OCIGenAIEmbeddings is for embeddings, and OracleVS is for vector store integration with Oracle Database.

6
MCQeasy

Which LangChain abstraction is responsible for storing and retrieving conversation history to maintain context across multiple turns in a chatbot?

A.Memory
B.Agent
C.Chain
D.Model
AnswerA

Memory explicitly stores and manages conversation history for context across turns.

Why this answer

Memory in LangChain is designed to store and retrieve conversation history, enabling context-aware responses. Models generate text, chains orchestrate steps, and agents decide actions — none handle history directly.

7
MCQmedium

An application uses LangChain's ConversationalRetrievalChain with memory. Users report that the chatbot occasionally repeats information from earlier in the conversation even when the new question is unrelated. What is the most likely cause?

A.The memory type is set to ConversationSummaryMemory
B.The chunk_size is too small, causing loss of context
C.The retriever is returning irrelevant documents from the conversation history
D.The LLM temperature is set too high
AnswerC

ConversationalRetrievalChain uses the chat history to formulate a new query; if the retrieval is broad, old topics may resurface.

Why this answer

The chain retrieves documents based on the conversation history plus the current question; if the retriever returns irrelevant chunks from past context, the LLM may repeat old information.

8
MCQmedium

A company wants to build a customer service chatbot that answers questions about their internal policy documents. The documents are updated monthly, and the team cannot afford to retrain a model each time. Which approach is MOST appropriate?

A.Use Retrieval-Augmented Generation (RAG) with the policy documents indexed in a vector store
B.Use a larger foundation model with a longer context window and paste all documents into each prompt
C.Fine-tune a base LLM on the policy documents monthly
D.Train a custom model from scratch on the policy documents each month
AnswerA

RAG retrieves relevant document chunks at query time, ensuring the chatbot always answers from the latest uploaded documents without any model retraining.

Why this answer

Retrieval-Augmented Generation (RAG) is the most appropriate approach because it allows the chatbot to answer questions by retrieving relevant chunks from the policy documents stored in a vector store at query time, without requiring model retraining. When documents are updated monthly, only the vector store needs to be re-indexed, while the underlying LLM remains unchanged, making it cost-effective and scalable.

Exam trap

The 1Z0-1127 exam often tests the misconception that fine-tuning or retraining is the only way to handle dynamic data, but the trap here is that RAG decouples knowledge updates from model updates, making it ideal for frequently changing documents without retraining costs.

How to eliminate wrong answers

Option B is wrong because pasting all policy documents into each prompt is impractical due to context window limits (e.g., 4K–128K tokens) and rapidly increasing costs; it also fails to scale as documents grow. Option C is wrong because fine-tuning a base LLM monthly is expensive, time-consuming, and risks catastrophic forgetting, especially when the updates are frequent and the model must retain general language capabilities. Option D is wrong because training a custom model from scratch each month is prohibitively expensive and unnecessary; it requires massive compute resources, large datasets, and expertise, making it unsuitable for a document update cycle.

9
MCQhard

A developer is using Oracle AI Vector Search with LangChain to build a RAG system on top of Oracle Database 23ai. They have created a VECTOR column and built an HNSW index. To improve recall at the cost of some accuracy, which index parameter should they adjust?

A.Increase the chunk_overlap in the text splitter
B.Increase the 'neighbors' parameter
C.Decrease the 'efConstruction' parameter
D.Switch from HNSW to IVF index type
AnswerB

More neighbors per node improves recall by exploring more paths, but trades off accuracy (more false positives) and resource usage.

Why this answer

Increasing the 'neighbors' parameter (M) in an HNSW index expands the number of bidirectional links per node during graph construction. This denser graph provides more alternative paths during search, improving recall because the search is less likely to miss relevant vectors, but it also increases memory usage and can slightly degrade search speed due to more edges to traverse.

Exam trap

The trap here is that candidates confuse the HNSW 'neighbors' parameter with the 'efConstruction' parameter, mistakenly thinking that decreasing efConstruction (which speeds up construction) would improve recall, when in fact it reduces the thoroughness of graph building and lowers recall.

How to eliminate wrong answers

Option A is wrong because chunk_overlap in the text splitter controls how much text overlaps between consecutive chunks, which affects context continuity but has no direct impact on the vector index's recall-vs-accuracy trade-off. Option C is wrong because decreasing 'efConstruction' reduces the size of the dynamic candidate list during HNSW index construction, which actually lowers recall (opposite of the goal) and may speed up construction but does not improve recall. Option D is wrong because switching from HNSW to IVF (Inverted File) index type typically trades recall for faster search and lower memory, not the other way around; HNSW generally offers higher recall than IVF, so this change would not improve recall.

10
MCQmedium

A developer is using LangChain's RecursiveCharacterTextSplitter with chunk_size=1000 and chunk_overlap=200. Which statement best describes the resulting chunks?

A.Chunks are at most 1000 characters, and consecutive chunks overlap by 200 characters
B.Chunks are at most 1200 characters, overlapping by 200
C.Chunks are exactly 800 characters, with no overlap
D.Each chunk is exactly 1000 characters, with no overlap
AnswerA

The text splitter ensures chunks do not exceed chunk_size and overlap by chunk_overlap characters to maintain context.

Why this answer

With chunk_size=1000 and chunk_overlap=200, each chunk is up to 1000 characters and consecutive chunks share 200 characters of overlap to preserve context across boundaries. The splitter recursively tries to split on separators like newlines to keep chunks semantically coherent.

11
MCQmedium

A developer wants to index a large corpus of HTML web pages for a RAG pipeline using LangChain. They need to load the content from URLs, split the text into chunks, and generate embeddings. Which combination of LangChain components should they use?

A.PDFLoader, RecursiveCharacterTextSplitter, OCIGenAIEmbeddings
B.WebBaseLoader, RecursiveCharacterTextSplitter, OCIGenAIEmbeddings
C.CSVLoader, RecursiveCharacterTextSplitter, OCIGenAIEmbeddings
D.WebBaseLoader, TokenTextSplitter, OCIGenAI
AnswerB

WebBaseLoader loads web pages, splitter splits text, and embeddings generate vectors.

Why this answer

WebBaseLoader loads HTML content, RecursiveCharacterTextSplitter splits it, and OCIGenAIEmbeddings generates embeddings.

12
MCQmedium

A developer is using ChatPromptTemplate with MessagesPlaceholder to handle conversation history. What is the purpose of MessagesPlaceholder in the prompt template?

A.To insert a single user message at a specific position
B.To add a system instruction that is always present
C.To convert the chat history into a plain string for the LLM
D.To provide a slot where conversation history messages can be injected dynamically
AnswerD

MessagesPlaceholder is replaced by a list of messages (e.g., from memory) at runtime, enabling the model to see the conversation history.

Why this answer

MessagesPlaceholder in LangChain's ChatPromptTemplate is specifically designed to inject conversation history messages dynamically at a designated position in the prompt. It acts as a slot that can hold a list of messages (e.g., from a chat memory buffer) and is replaced at runtime with the actual history, allowing the LLM to maintain context across turns.

Exam trap

The trap here is that candidates confuse MessagesPlaceholder with a simple string substitution or a fixed message insertion, overlooking its role as a dynamic slot for structured message lists that preserves role semantics.

How to eliminate wrong answers

Option A is wrong because MessagesPlaceholder is not for inserting a single user message; that is done with a HumanMessagePromptTemplate or a plain string. Option B is wrong because a system instruction that is always present is added via SystemMessagePromptTemplate, not MessagesPlaceholder. Option C is wrong because MessagesPlaceholder keeps messages in their structured format (e.g., HumanMessage, AIMessage) rather than converting them to a plain string; the LLM receives them as a list of message objects.

13
MCQeasy

Which LangChain document loader should be used to load text from a web page given its URL?

A.WebBaseLoader
B.CSVLoader
C.PDFLoader
D.TextLoader
AnswerA

WebBaseLoader loads content from a web page URL.

Why this answer

WebBaseLoader is a LangChain document loader that fetches a web page from a URL and extracts its text content. PDFLoader loads PDFs, TextLoader loads local text files, and CSVLoader loads CSV files.

14
MCQhard

An AI application uses LangChain's LCEL with the | operator to compose a chain: prompt | model | output_parser. During testing, the developer notices that the output_parser is not receiving the expected input format from the model. What is the most likely cause?

A.The | operator requires all components to have the same input/output types
B.The prompt is not correctly formatting the input for the model
C.The output_parser is expecting a string, but the model returns an AIMessage object
D.The model's streaming mode is enabled, causing the output to be streamed as chunks
AnswerC

Many LangChain models return structured message objects; if the parser expects a raw string, it will fail unless a StrOutputParser is used.

Why this answer

In LangChain's LCEL, the `|` operator passes the output of one component as input to the next. A typical LLM model invocation returns an `AIMessage` object (or `LLMResult`), not a plain string. The `output_parser` in this chain expects a string input (e.g., `StrOutputParser`), but receives an `AIMessage`, causing a type mismatch.

This is the most common cause of the described failure.

Exam trap

The 1Z0-1127 exam often tests the misconception that the `|` operator enforces strict type consistency across all components, when in reality it only passes outputs as inputs, and type mismatches (like `AIMessage` vs. string) are the actual failure point.

How to eliminate wrong answers

Option A is wrong because the `|` operator does not require all components to have the same input/output types; it simply passes the output of one component as input to the next, and type compatibility is enforced at runtime. Option B is wrong because the prompt's formatting affects the input to the model, not the output from the model to the output_parser; the issue is downstream. Option D is wrong because streaming mode would cause the model to yield chunks (e.g., `AIMessageChunk` objects) rather than a single `AIMessage`, but the core problem remains a type mismatch, not the streaming behavior itself.

15
Multi-Selecthard

You need to build a RAG pipeline using LangChain and OCI Generative AI. The pipeline must load PDF documents, split them into chunks, embed them, store in a vector store, and retrieve relevant chunks at query time. Which THREE components are essential? (Choose THREE.)

Select 3 answers
A.RecursiveCharacterTextSplitter
B.PDFLoader
C.OCIGenAIEmbeddings
D.CSVLoader
E.Chroma
AnswersA, B, C

Text splitter is needed to split large documents into manageable chunks.

Why this answer

A is correct because RecursiveCharacterTextSplitter is the standard text splitter in LangChain for splitting documents into chunks while preserving semantic boundaries (e.g., paragraphs, sentences). It recursively splits on different separators (like newlines, spaces) to maintain context, which is critical for effective retrieval in a RAG pipeline.

Exam trap

The 1Z0-1127 exam often tests the distinction between essential components and optional implementations — candidates mistakenly select Chroma (a specific vector store) as essential, when the core requirement is only that embeddings are stored and retrieved, not that a particular store like Chroma must be used.

16
MCQeasy

Which LangChain memory type stores the entire conversation history as a list of messages and is best for simple, short conversations?

A.ConversationTokenBufferMemory
B.ConversationSummaryMemory
C.ConversationBufferMemory
D.ConversationBufferWindowMemory
AnswerC

BufferMemory stores the complete list of messages.

Why this answer

ConversationBufferMemory stores the full history, making it suitable for short dialogues but not for long ones due to token limits.

17
MCQeasy

In LangChain's Expression Language (LCEL), what does the pipe (|) operator do when connecting components?

A.It conditionally selects one of the two components based on a flag
B.It repeats the left component's execution until a condition is met
C.It passes the output of the left component as input to the right component
D.It runs both components in parallel and merges their outputs
AnswerC

This is the core behavior of LCEL — each component's output becomes the next component's input, enabling easy chain construction.

Why this answer

In LCEL, the | operator chains components by passing the output of the left component as input to the right component. This allows composing chains like prompt | model | output parser.

18
MCQhard

A LangChain application using ChatOCIGenAI is hitting rate limits from the OCI Generative AI service. The developer wants to implement retry logic with exponential backoff. Which approach is most appropriate in LangChain?

A.Reduce the number of concurrent requests by setting a semaphore in the application code
B.Use a middleware in the FastAPI application to queue requests and retry with exponential backoff
C.Set the max_retries and request_timeout parameters in ChatOCIGenAI, and use a custom callback to handle rate limit errors with exponential backoff
D.Wrap the ChatOCIGenAI instance with a RetryFromLLM callback that implements exponential backoff
AnswerC

Configuring max_retries and request_timeout on the model wrapper, combined with a callback that catches rate limit errors and implements exponential backoff, is the standard pattern in LangChain.

Why this answer

LangChain's built-in retry mechanism for LLMs can be configured via the request_timeout and max_retries parameters on the model wrapper. Additionally, using a custom callback or middleware can implement exponential backoff. The other options either do not address rate limits or are not native to LangChain.

19
MCQmedium

A LangChain application uses an agent with a calculator tool and a search tool. The agent is supposed to answer a question that requires both arithmetic and web lookup, but it only uses the search tool and gives an approximate answer. Which agent type is MOST likely to correctly combine the tools?

A.Zero-shot agent without ReAct (e.g., zero-shot-react-description)
B.Structured tool chat agent
C.Conversational agent with memory
D.ReAct agent (e.g., zero-shot-react-description)
AnswerD

ReAct agents reason step by step, allowing them to use multiple tools as needed.

Why this answer

The ReAct agent (zero-shot-react-description) is designed to reason step-by-step and decide which tool to use based on the task. It can combine the calculator and search tools by first performing a web lookup to get necessary data, then using the calculator tool for arithmetic, producing an exact answer. This agent type explicitly supports multi-step reasoning and tool selection, unlike simpler agents that may default to a single tool.

Exam trap

The 1Z0-1127 exam often tests the misconception that any agent with tool descriptions can automatically chain tools, but the key differentiator is the ReAct reasoning loop that enables explicit step-by-step tool selection and execution.

How to eliminate wrong answers

Option A is wrong because a zero-shot agent without ReAct lacks the reasoning loop to decide when to use multiple tools; it typically picks one tool based on the prompt and cannot chain tool calls. Option B is wrong because the structured tool chat agent is designed for structured inputs/outputs (e.g., JSON schemas) and does not inherently improve multi-tool reasoning; it still relies on the underlying agent logic, which may not chain tools effectively. Option C is wrong because a conversational agent with memory focuses on maintaining conversation history, not on multi-step tool orchestration; memory does not enable the agent to decide to use both calculator and search tools sequentially.

20
MCQmedium

A developer needs to include the conversation history in a prompt for a LangChain chatbot. They want to insert previous exchanges between the user and the AI into the prompt at a specific position. Which component should they use?

A.PromptTemplate
B.MessagesPlaceholder
C.ChatPromptTemplate
D.ConversationBufferMemory
AnswerB

MessagesPlaceholder defines a variable position in the prompt where a list of messages (history) will be inserted.

Why this answer

MessagesPlaceholder is the correct component because it is specifically designed to inject a list of messages (e.g., conversation history) at a designated position within a ChatPromptTemplate. It acts as a slot that gets replaced with the actual message list at runtime, allowing the developer to control exactly where previous exchanges appear in the prompt.

Exam trap

The 1Z0-1127 exam often tests the distinction between a prompt component (MessagesPlaceholder) and a memory component (ConversationBufferMemory), leading candidates to mistakenly choose the memory class when the question asks for a prompt injection mechanism.

How to eliminate wrong answers

Option A is wrong because PromptTemplate is used for simple string templates and does not support structured message lists or the concept of a placeholder for conversation history. Option C is wrong because ChatPromptTemplate is the container that holds the sequence of messages (system, human, AI, and placeholders), but it is not the component that directly inserts the history at a specific position—that is the job of MessagesPlaceholder. Option D is wrong because ConversationBufferMemory is a memory class that stores and retrieves conversation history, but it is not a prompt component; it must be used with a MessagesPlaceholder or similar mechanism to inject the history into the prompt.

21
MCQmedium

In LangChain, what is the purpose of the LCEL (LangChain Expression Language) | operator?

A.To pipe the output of one component into the next component
B.To run two chains in parallel
C.To concatenate two prompt templates
D.To compare outputs of two different models
AnswerA

The | operator passes the output of the left component as input to the right component.

Why this answer

The | operator in LCEL is used to compose chains by passing the output of one component as input to the next.

22
MCQmedium

A developer wants to compose a LangChain pipeline using the LCEL (LangChain Expression Language) to combine a prompt template, a model, and an output parser. Which operator is used for this composition?

A.>> (right shift) operator
B.-> (arrow) operator
C.| (pipe) operator
D.+ (plus) operator
AnswerC

LCEL uses the | operator to compose chains.

Why this answer

In LangChain Expression Language (LCEL), the pipe operator `|` is used to compose components like prompt templates, models, and output parsers into a single chain. This operator passes the output of one component as the input to the next, enabling a clean, declarative pipeline syntax.

Exam trap

OCI often tests the LCEL pipe operator by presenting operators from other programming paradigms (like `>>` for bit shifting or `->` for arrow functions) to confuse candidates who are not familiar with LangChain's specific syntax.

How to eliminate wrong answers

Option A is wrong because the `>>` (right shift) operator is not used in LCEL; it is commonly associated with bitwise operations or stream redirection in other languages, not LangChain composition. Option B is wrong because the `->` (arrow) operator is not part of LCEL; it is often used in lambda expressions or method references in languages like Java or C++, not for chaining LangChain components. Option D is wrong because the `+` (plus) operator is not used for composition in LCEL; it is typically used for arithmetic or string concatenation, not for defining execution pipelines.

23
Multi-Selecthard

An organization is deploying a RAG application with Oracle AI Vector Search. They need to ensure that the vector index supports low-latency queries and can handle updates to the underlying documents (inserts, deletes, modifications) without significant performance degradation. Which two index features should they consider? (Choose TWO.)

Select 2 answers
A.Use a VECTOR data type with a default B-tree index
B.Use an IVF index with periodic rebuilds to maintain performance after many updates
C.Enable exact nearest neighbor search to avoid index maintenance
D.Disable indexing and rely on full table scan for simplicity
E.Use an HNSW index, which supports incremental updates and provides low-latency search
AnswersB, E

IVF indexes can be rebuilt periodically to handle updates; with proper maintenance, they can provide low-latency queries.

Why this answer

An IVF (Inverted File) index with periodic rebuilds is well-suited for RAG applications that experience frequent updates (inserts, deletes, modifications). IVF indexes are designed for approximate nearest neighbor search, offering low-latency queries, but they can degrade over time as data changes; periodic rebuilds restore performance without requiring a full re-index of the entire dataset. This approach balances query speed with update tolerance, making it a practical choice for dynamic document collections in Oracle AI Vector Search.

Exam trap

The 1Z0-1127 exam often tests the misconception that HNSW indexes are always superior for dynamic workloads, but the question explicitly asks for two features that support low-latency queries and handle updates, and both IVF with periodic rebuilds and HNSW are valid; the trap is that candidates might overlook the periodic rebuild requirement for IVF or incorrectly assume HNSW is the only option, leading them to select only one correct answer or to dismiss IVF entirely.

24
MCQmedium

A company is using Oracle AI Vector Search in Oracle Database 23ai for semantic search over product descriptions. They need to create an index that supports approximate nearest neighbor search with high recall and moderate indexing time. Which index type and parameters should they choose?

A.Exact nearest neighbor search without an index
B.HNSW index with default parameters
C.No index — rely on full table scan
D.IVF index with a large number of centroids
AnswerB

HNSW typically provides high recall and moderate indexing time compared to exact search, making it suitable for production semantic search.

Why this answer

HNSW (Hierarchical Navigable Small World) indexes offer high recall and faster search times, but building the index takes longer. IVF (Inverted File) indexes index faster but may have lower recall unless tuned. For high recall and moderate indexing time, HNSW is preferred because it provides better accuracy at the cost of longer build time.

25
Multi-Selectmedium

A developer is building a LangChain RAG pipeline with OCI Generative AI. Which TWO components are needed to create embeddings from documents and store them for retrieval?

Select 2 answers
A.DocumentLoader
B.OCIGenAIEmbeddings
C.ChatOCIGenAI
D.Vector store (e.g., FAISS, OracleVS)
E.TextSplitter
AnswersB, D

This wraps OCI's embedding models.

Why this answer

OCIGenAIEmbeddings converts text into embeddings, and a vector store (e.g., FAISS, Chroma, OracleVS) stores those embeddings for similarity search. Document loaders and text splitters are used before embedding but are not part of the embedding/storage step itself.

26
MCQmedium

A developer uses the ReAct agent in LangChain with a calculator tool and a search tool. The agent receives the question: 'What is the population of Paris multiplied by 3?' The agent first calls the search tool to find the population, then calls the calculator tool to multiply it by 3. Which component is responsible for deciding the sequence of tool calls?

A.The LLM
B.The Memory
C.The Tool
D.The AgentExecutor
AnswerD

The AgentExecutor repeatedly invokes the LLM, executes tool calls, and passes results back until the agent stops.

Why this answer

The AgentExecutor orchestrates the agent's reasoning loop: it calls the LLM which decides the next action (tool call) based on the prompt (ReAct pattern). The LLM generates actions, the AgentExecutor executes them and feeds results back to the LLM until a final answer is produced. Tools are just functions, the Agent defines the prompt, and Memory stores history.

27
MCQmedium

A team is implementing a conversational chatbot that needs to remember a user's previous messages within the same session. They are using LangChain with OCI Generative AI. Which memory type and persistence approach should they choose for session-only memory?

A.ConversationBufferMemory persisted in a vector store
B.ConversationSummaryMemory stored in a local file
C.ConversationBufferMemory stored in-memory
D.ConversationSummaryMemory persisted in Oracle Database
AnswerC

Buffer memory retains the full conversation history in Python memory, ideal for session-scoped chatbots that do not require long-term persistence.

Why this answer

ConversationBufferMemory stores the full message history in memory, suitable for short sessions. For session-only memory, in-memory persistence is sufficient; no external database is needed. Summary memory is more suited for long conversations where token limits are a concern.

28
MCQmedium

A developer is using LangChain to build a RAG pipeline with Oracle Database 23ai as the vector store. Which LangChain wrapper should they use to create embeddings and store them in the database?

A.OCIGenAI for embeddings and FAISS for storage
B.HuggingFaceEmbeddings for embeddings and OracleVS for storage
C.ChatOCIGenAI for embeddings and Chroma for storage
D.OCIGenAIEmbeddings for embeddings and OracleVS for storage
AnswerD

OCIGenAIEmbeddings generates embeddings using Oracle's embedding models, and OracleVS stores them in Oracle Database 23ai with native vector support.

Why this answer

OCIGenAIEmbeddings is the LangChain wrapper for Oracle's embedding models, and OracleVS connects to Oracle Database 23ai for vector storage. The other options either refer to incorrect wrappers or are not designed for this purpose.

29
MCQmedium

A team is building an agent using LangChain that needs to perform calculations and search the web for current information. Which combination of tools and agent type should they use?

A.Zero-shot agent with only a calculator tool
B.Conversational agent with a search tool and memory
C.ReAct agent with a search tool only
D.ReAct agent with a calculator tool and a search tool
AnswerD

ReAct agents combine reasoning and acting; a calculator handles arithmetic, and a search tool retrieves live web data.

Why this answer

A ReAct agent reasons step-by-step and uses tools like a calculator for math and a search tool for web queries. The ReAct framework is designed for such tool-use tasks. The other options either omit necessary tools or use an incorrect agent type.

30
Multi-Selectmedium

A developer is building a LangChain application that uses OCI Generative AI service. They want to implement streaming responses from the LLM to improve user experience. Which TWO actions are necessary to enable streaming?

Select 2 answers
A.Use a StreamingStdOutCallbackHandler or custom callback to handle stream events
B.Increase the chunk_size to speed up streaming
C.Disable memory to avoid buffering the stream
D.Use async LangChain syntax for streaming
E.Set the 'streaming' parameter to True when invoking the ChatOCIGenAI model
AnswersA, E

Why this answer

LangChain's streaming architecture requires a callback handler (like `StreamingStdOutCallbackHandler` or a custom one) to process tokens as they are emitted from the LLM. Without a callback, the stream events are generated but not consumed, so the application cannot output partial results in real time.

Exam trap

The trap here is that candidates confuse the `streaming` parameter (which tells the model to use the streaming API) with the callback handler (which actually processes the stream), assuming one alone is sufficient, but both are required for a complete streaming implementation.

31
MCQeasy

Which of the following best describes the role of a Retriever in a LangChain RAG pipeline?

A.It splits documents into smaller chunks
B.It loads documents from various sources like PDF or HTML
C.It encodes documents into dense vector representations
D.It fetches relevant document chunks from a vector store based on a query
AnswerD

A Retriever's primary function is to retrieve relevant documents from a store using similarity search or other methods.

Why this answer

A Retriever is responsible for fetching relevant documents from a vector store based on a query. It abstracts the search logic so that downstream components (like LLMChain) can use the retrieved context. Document loaders handle input, embeddings convert text to vectors, and splitters divide documents.

32
Multi-Selecteasy

A developer is building a RAG pipeline with LangChain. They have loaded PDF documents with PDFLoader. Which TWO steps must they perform before indexing the documents into a vector store?

Select 2 answers
A.Translate the documents into English
B.Split the documents into chunks using a text splitter
C.Encrypt the documents with AES-256
D.Embed the document chunks using an embedding model
E.Compress the documents with gzip
AnswersB, D

Splitting ensures each chunk fits the model's token limit and improves retrieval granularity.

Why this answer

Documents loaded from PDFs must be split into smaller chunks (using a text splitter) and then embedded into vector representations before they can be indexed in a vector store.

33
Multi-Selecteasy

Which THREE of the following are core LangChain components?

Select 3 answers
A.Memory
B.Embeddings
C.Prompts
D.Tokens
E.Models
AnswersA, C, E

Why this answer

LangChain core components include Models, Prompts, Memory, Agents, Retrievers, Document Loaders, Chains, etc.

34
Multi-Selectmedium

A team is building a LangChain agent that needs to answer questions using both a company-internal knowledge base (stored in Oracle AI Vector Search) and live web search. Which THREE components should they include in the agent setup?

Select 3 answers
A.AgentExecutor to manage the ReAct loop
B.A tool wrapping the vector store retriever
C.ConversationBufferMemory for storing chat history
D.A custom tool for logging agent steps
E.A tool wrapping a web search engine (e.g., Tavily, SerpAPI)
AnswersA, B, E

AgentExecutor runs the agent's reasoning and tool execution loop.

Why this answer

A LangChain agent requires a set of tools (vector store retriever as a tool, web search tool), and an AgentExecutor to orchestrate the reasoning and tool calls. The LLM is already part of the agent definition.

35
Multi-Selecteasy

A company wants to use LangChain to build a chatbot that remembers previous conversations across sessions. Which TWO components should they use together?

Select 2 answers
A.LLMChain
B.ChatMessageHistory with a persistent backend (e.g., RedisChatMessageHistory)
C.ConversationBufferMemory
D.AgentExecutor
E.OCIGenAIEmbeddings
AnswersB, C

Persists messages across sessions.

Why this answer

To persist chat history across sessions, you need a memory type that stores history externally, such as ConversationBufferMemory combined with a persistent store like RedisChatMessageHistory. ConversationSummaryMemory can also be persisted similarly. The other options are not memory types.

36
MCQmedium

A team is using LangChain's ConversationalRetrievalChain with ConversationBufferMemory to build a chatbot. After a few turns, the chatbot starts repeating information from earlier messages. What is the MOST likely cause?

A.The conversation history accumulates in the prompt, causing the model to focus on past messages
B.The chunk_size in the text splitter is too large
C.The LLM's max_tokens parameter is set too low
D.The retriever's similarity search returns irrelevant chunks
AnswerA

Full history in the prompt can cause the model to rephrase or repeat past content.

Why this answer

ConversationBufferMemory stores the entire conversation history, and each new query appends that history to the prompt. As history grows, the LLM may receive redundant context, causing repetition. Using ConversationSummaryMemory or limiting history length can mitigate this.

37
MCQmedium

An AI developer is building a document Q&A application using LangChain and OCI Generative AI. They need to split large PDF documents into smaller chunks before embedding. Which text splitter should they use to ensure splits respect sentence boundaries while also controlling chunk size?

A.RecursiveCharacterTextSplitter
B.WebBaseLoader
C.PDFLoader
D.TokenTextSplitter
AnswerA

This splitter recursively splits text by a list of separators, keeping paragraphs and sentences intact while controlling chunk size.

Why this answer

RecursiveCharacterTextSplitter splits text recursively by separators (like \n\n, \n, period) to keep semantically related text together and respects sentence-like boundaries. TokenTextSplitter splits by tokens without regard for sentence boundaries. PDFLoader and WebBaseLoader are document loaders, not splitters.

38
MCQhard

A company is deploying a LangChain agent that uses a custom tool to query an external API. The agent must handle rate limits gracefully. Which approach should the developer implement?

A.Increase the tool's timeout to reduce request frequency
B.Deploy multiple agent instances to distribute requests
C.Ignore rate limits and rely on the LLM to slow down
D.Use the Tool's built-in RateLimiter wrapper with a specified max_requests_per_second
AnswerD

The RateLimiter wrapper automatically throttles calls to the tool.

Why this answer

LangChain provides a built-in RateLimiter tool wrapper that can be applied to any tool to enforce rate limits. Alternatively, custom retry logic can be added, but using the built-in wrapper is the recommended pattern.

39
MCQeasy

Which Oracle AI Vector Search index type is designed for approximate nearest neighbor search and uses a navigable small world graph?

A.VECTOR
B.HNSW
C.IVF
D.BTREE
AnswerB

HNSW uses a multi-layer navigable small world graph for efficient ANN search.

Why this answer

HNSW (Hierarchical Navigable Small World) is a graph-based index for ANN search.

40
Multi-Selecthard

A data scientist is designing a RAG pipeline using LangChain and Oracle AI Vector Search. They want to ensure that the retrieved documents are diverse and not overly similar to each other. Which TWO approaches can achieve this?

Select 2 answers
A.Set fetch_k larger than k in the retriever's search_kwargs and use MMR
B.Use a smaller chunk_size to create more granular chunks
C.Use a higher chunk_overlap to increase redundancy
D.Use as_retriever with search_type='mmr'
E.Use similarity_search with a high k value
AnswersA, D

Why this answer

MMR (Maximum Marginal Relevance) is designed to balance relevance and diversity. Setting fetch_k > k in the retriever and using MMR can also improve diversity.

41
MCQmedium

A developer is using LangChain's LCEL to build a RAG pipeline. They want to add streaming of the final answer to the user. Which LCEL feature enables streaming output from the model?

A.Setting streaming=True in the model constructor
B.Calling .stream() on the composed chain
C.Using .invoke() with a callable
D.The | operator between components
AnswerB

.stream() allows the chain to yield output tokens as they are generated, enabling streaming to the user.

Why this answer

The | operator in LCEL composes components but does not inherently stream. .stream() is a method on runnable objects that yields output chunks. .invoke() returns the full output. .batch() processes multiple inputs.

42
MCQeasy

In LangChain, which component is responsible for connecting a language model to a retriever and a prompt template to answer questions based on retrieved documents?

A.RetrievalQA chain
B.LLMChain
C.SequentialChain
D.AgentExecutor
AnswerA

RetrievalQA chain integrates a retriever and an LLM to generate answers from retrieved context.

Why this answer

RetrievalQA chain is designed to combine a retriever and an LLM to answer questions based on retrieved documents.

43
MCQmedium

A developer is building a RAG pipeline using LangChain and OCI Generative AI. They need to split a large PDF into overlapping chunks for embedding. Which text splitter and parameter settings are MOST appropriate?

A.RecursiveCharacterTextSplitter with chunk_size=1000, chunk_overlap=200
B.CharacterTextSplitter with chunk_size=500, chunk_overlap=50
C.TokenTextSplitter with chunk_size=512, chunk_overlap=0
D.MarkdownHeaderTextSplitter with chunk_size=1000, chunk_overlap=200
AnswerA

This splitter attempts to split at natural boundaries (paragraphs, sentences) and the overlap preserves context.

Why this answer

RecursiveCharacterTextSplitter is designed to split text while maintaining paragraphs and sentences. chunk_size=1000 with chunk_overlap=200 is a typical starting point to preserve context across chunks. TokenTextSplitter counts tokens, which is useful for LLM context limits, but here the requirement is about the text splitter for general use; RecursiveCharacterTextSplitter is the standard choice.

44
MCQmedium

A team wants to deploy a LangChain agent that can perform mathematical calculations, look up current weather, and search the web. Which tools should they include in the agent's toolkit?

A.Calculator tool, weather API tool, and web search tool
B.Only a web search tool, because the LLM can handle calculations internally
C.Calculator tool and a retriever tool that fetches from a pre-defined knowledge base
D.A single LLM tool that can handle all three tasks
AnswerA

These three dedicated tools cover the required capabilities: math, real-time weather, and web search.

Why this answer

An agent needs specific tools for each capability: a calculator tool for math, a weather API tool for weather, and a web search tool for searching. A single LLM tool or retriever cannot replace dedicated tools for these distinct tasks.

45
MCQeasy

Which LangChain component is responsible for splitting long documents into smaller, overlapping chunks before embedding?

A.Text Splitter
B.Retriever
C.Vector Store
D.Document Loader
AnswerA

Text splitters are specifically designed to break documents into manageable chunks for embedding.

Why this answer

Text splitters (e.g., RecursiveCharacterTextSplitter) divide documents into chunks of a specified size with optional overlap. This ensures each chunk fits within the embedding model's token limit and preserves context at boundaries.

46
MCQhard

A company uses LangChain with OCI Generative AI. They notice that their agent-based application occasionally exceeds the rate limits of the OCI Generative AI service, causing errors. Which strategy is MOST effective for handling rate limits in a production LangChain application?

A.Implement a retry mechanism with exponential backoff when calling the model
B.Increase the k value in the retriever to reduce the number of API calls
C.Switch to a smaller model to reduce token consumption
D.Reduce the chunk_size parameter in text splitters
AnswerA

Retry with exponential backoff is the standard approach to handle rate limiting errors gracefully.

Why this answer

Using a retry mechanism with exponential backoff is a standard and effective approach for handling rate limits.

47
MCQmedium

A developer needs to build a chain that first summarizes a long document, then translates the summary into French. Which LangChain chain type allows executing these steps in sequence with the output of one step feeding into the next?

A.RetrievalQA
B.SequentialChain
C.LLMChain
D.ConversationalRetrievalChain
AnswerB

SequentialChain chains multiple sub-chains, passing outputs as inputs to subsequent steps.

Why this answer

SequentialChain is designed to run multiple chains in order, where the output of each chain becomes input to the next. This fits the use case of summarizing then translating.

48
MCQeasy

Which LangChain component is responsible for storing and retrieving message history across multiple turns in a conversation?

A.Memory
B.PromptTemplate
C.Chain
D.Tool
AnswerA

Memory stores and retrieves conversation history, enabling context-aware multi-turn interactions.

Why this answer

Memory is the correct component because it is specifically designed to store and retrieve conversation history across multiple turns, enabling the model to maintain context. Unlike stateless components, Memory persists past interactions (e.g., via buffer or summary mechanisms) and feeds them into the prompt for subsequent LLM calls.

Exam trap

A common misconception is that Chain inherently remembers conversation history, but Chain is stateless by default and requires explicit Memory attachment to retain context across turns.

How to eliminate wrong answers

Option B (PromptTemplate) is wrong because it only defines the structure of the input prompt (e.g., placeholders for variables) and has no capability to store or retrieve historical messages. Option C (Chain) is wrong because it orchestrates sequences of calls (e.g., LLM + tools) but does not inherently persist state; any memory must be explicitly attached via a Memory object. Option D (Tool) is wrong because it represents an external function or API (e.g., a search engine or calculator) that the agent can invoke, not a mechanism for storing conversation history.

49
MCQmedium

A developer is building a LangChain-powered application that must maintain conversation history across multiple turns. They want to store the chat history in Oracle Database. Which memory type and persistence approach should they use?

A.ConversationSummaryMemory with in-memory storage
B.ConversationBufferWindowMemory with Redis persistence
C.ConversationKGMemory with file-based storage
D.ConversationBufferMemory with a custom chat message history class backed by Oracle Database
AnswerD

BufferMemory preserves the complete conversation; a custom Oracle-backed history class persists it durably across sessions.

Why this answer

The requirement explicitly states storing chat history in Oracle Database. ConversationBufferMemory stores the full conversation history without summarization or windowing, and by implementing a custom chat message history class backed by Oracle Database, the developer can persist the conversation history directly in Oracle, meeting both the memory type and persistence requirements.

Exam trap

The trap here is that candidates may choose a memory type like ConversationSummaryMemory or ConversationBufferWindowMemory for efficiency, overlooking the explicit requirement to store the full history in Oracle Database, and instead defaulting to simpler in-memory or Redis-based solutions.

How to eliminate wrong answers

Option A is wrong because ConversationSummaryMemory stores a summarized version of the conversation, which loses detail, and in-memory storage does not persist data to Oracle Database. Option B is wrong because ConversationBufferWindowMemory only retains a fixed window of recent messages, discarding older context, and Redis persistence does not use Oracle Database. Option C is wrong because ConversationKGMemory stores a knowledge graph of entities and relationships, not the raw conversation history, and file-based storage does not use Oracle Database.

50
MCQmedium

When using LangChain's RetrievalQA chain with `chain_type="stuff"`, what happens if the retrieved documents exceed the model's context window?

A.The chain automatically truncates the documents to fit
B.The chain raises an error because the input is too long
C.The chain uses a sliding window to summarize documents
D.The chain switches to a different model with larger context
AnswerB

Stuff chain will fail due to context length exceeded.

Why this answer

The "stuff" chain type simply concatenates all retrieved documents into the prompt. If the total exceeds the context window, a TokenLimitError or similar error occurs. Other chain types like "map_reduce" or "refine" can handle larger contexts.

51
MCQhard

In Oracle AI Vector Search, which index type is designed for approximate nearest neighbor search and employs a hierarchical navigable small world graph, offering high recall and fast search speeds for high-dimensional data?

A.BTREE
B.IVF
C.HNSW
D.VECTOR
AnswerC

HNSW uses a multi-layer graph structure for fast approximate nearest neighbor search with high recall.

Why this answer

HNSW (Hierarchical Navigable Small World) is a graph-based index that provides efficient approximate nearest neighbor search. IVF (Inverted File) uses clustering, and BTREE is for scalar data. VECTOR is a data type, not an index.

52
Multi-Selectmedium

A developer is using LangChain's ChatPromptTemplate to construct a prompt for a conversational agent. The prompt should include a system message, a placeholder for conversation history, and the latest user query. Which TWO components should they include in the template?

Select 2 answers
A.AIMessage
B.SystemMessage
C.MessagesPlaceholder with variable name 'history'
D.HumanMessage
AnswersB, C

SystemMessage is correct because it defines the system-level instruction for the agent.

Why this answer

The two necessary components are a SystemMessage to set the agent's behavior and a MessagesPlaceholder to store conversation history. The latest user query is provided as the input variable to the template at runtime, not as a static component in the template itself. Therefore, HumanMessage is not required in the template definition.

Exam trap

Oracle exams often test the distinction between message types used in prompt construction versus message types used in conversation history, leading candidates to incorrectly include `AIMessage` as a template component when it should only appear in the `history` placeholder.

53
MCQmedium

A developer is building a RAG pipeline using LangChain and Oracle AI Vector Search. After loading and splitting PDF documents, they generate embeddings and store them in Oracle Database using OracleVS. Which method should they call on the vector store object to create a retriever that uses similarity search with a configurable number of results?

A.as_retriever()
B.from_texts()
C.max_marginal_relevance_search()
D.similarity_search()
AnswerA

as_retriever() creates a retriever that uses the vector store's search method.

Why this answer

The as_retriever() method on a vector store returns a retriever object that can be configured with search_kwargs like 'k'.

54
MCQeasy

Which LangChain memory type is best suited for a long-running conversation where token consumption must be minimized, and the gist of previous exchanges should be retained?

A.ConversationBufferMemory
B.VectorStoreMemory
C.ConversationBufferWindowMemory
D.ConversationSummaryMemory
AnswerD

Summary memory periodically summarizes the conversation, significantly reducing token count while maintaining context.

Why this answer

ConversationSummaryMemory (D) is best suited for long-running conversations where token consumption must be minimized because it periodically summarizes the conversation history, retaining the gist of previous exchanges in a compressed form. This avoids storing every raw message (as in BufferMemory) while still preserving context, making it ideal for cost-sensitive or token-limited LLM deployments.

Exam trap

The 1Z0-1127 exam often tests the distinction between 'retaining the gist' (summarization) versus 'retaining recent messages' (window) or 'retaining everything' (buffer), and the trap here is that candidates confuse ConversationBufferWindowMemory (which drops old context) with a memory that preserves the essence of all prior exchanges.

How to eliminate wrong answers

Option A (ConversationBufferMemory) is wrong because it stores every message in full, leading to unbounded token consumption that grows linearly with conversation length, making it unsuitable for long-running chats. Option B (VectorStoreMemory) is wrong because it is designed for semantic search over large document stores, not for compact summarization of conversation history; it stores embeddings and retrieves chunks, which incurs high token and compute overhead for chat context. Option C (ConversationBufferWindowMemory) is wrong because it only keeps a fixed window of recent messages, discarding older context entirely, so the gist of early exchanges is lost, which fails the requirement to retain the gist of previous exchanges.

55
MCQmedium

A developer is using LangChain's ConversationBufferMemory to store chat history. They notice that after many turns, the prompt becomes too large and exceeds the model's context window. What is the BEST memory type to use for this scenario?

A.ConversationEntityMemory
B.ConversationBufferMemory with a large max_token_limit
C.ConversationSummaryMemory
D.ConversationStringBufferMemory
AnswerC

Summary memory compresses history into summaries, keeping the prompt small.

Why this answer

ConversationSummaryMemory periodically summarizes the conversation, keeping the prompt size manageable. It retains the gist of the conversation while reducing token usage.

56
Multi-Selecthard

A company is deploying a LangChain application using OCI Generative AI. They need to comply with a policy that requires all prompts sent to the LLM to be logged for audit, and they must also handle rate limits gracefully. Which TWO strategies should they implement?

Select 2 answers
A.Use a faster LLM to reduce response time
B.Implement a custom LangChain callback that logs the prompt before sending it to the model
C.Increase the batch size of requests to reduce the number of API calls
D.Wrap the LLM call in a retry mechanism with exponential backoff to handle rate limit errors
E.Store the full conversation history in the prompt's system message
AnswersB, D

Callbacks are the idiomatic way to intercept and log prompts in LangChain.

Why this answer

Using LangChain callbacks (e.g., on_llm_start) allows capturing prompts for logging without modifying the chain. For rate limits, adding a retry with exponential backoff (e.g., via tenacity or a custom callback) ensures resilience without dropping requests.

57
MCQhard

An organization needs to implement a RAG application with Oracle AI Vector Search but has strict latency requirements. They have millions of vectors. Which index type is likely to provide the best search speed while maintaining reasonable recall?

A.No index, relying on the VECTOR data type only
B.IVF (Inverted File) index
C.BTREE index
D.Exhaustive search (no index)
AnswerB

IVF uses clustering to limit search to a subset of vectors, offering a good trade-off between speed and recall.

Why this answer

IVF (Inverted File) partitions the vector space into clusters, reducing search scope. It typically offers faster search than exhaustive search and good recall, especially for large datasets. HNSW may also be fast but can have higher memory usage.

BTREE is for scalar data. Exhaustive search is too slow.

58
Multi-Selectmedium

A developer is building a conversational AI application using LangChain and needs to persist chat history across sessions. Which TWO approaches can they use? (Choose TWO.)

Select 2 answers
A.Use the agent's memory parameter with a default in-memory store
B.Enable streaming responses to automatically save history
C.Use ChatMessageHistory without a backing store
D.Use ConversationSummaryMemory and store the summary in a file
E.Use ConversationBufferMemory and save the buffer to a database
AnswersD, E

SummaryMemory keeps a running summary; persisting the summary file allows restoring history.

Why this answer

ConversationSummaryMemory can be persisted by storing its summary in a file, which allows chat history to survive across sessions. Option E is correct because ConversationBufferMemory can be explicitly saved to a database, providing durable storage for the conversation buffer. Both approaches decouple memory from the in-memory lifecycle, enabling cross-session persistence.

Exam trap

The 1Z0-1127 exam often tests the misconception that any memory parameter or streaming feature inherently provides persistence, when in fact persistence requires an explicit storage backend such as a file, database, or external key-value store.

59
Multi-Selectmedium

A company is deploying a LangChain application on OCI and needs to implement error handling and rate limit management. Which THREE strategies should they consider? (Choose THREE.)

Select 3 answers
A.Implement retry logic with exponential backoff when receiving 429 (Too Many Requests) responses
B.Increase the chunk_size parameter in the text splitter
C.Use a caching layer to avoid repeating identical API calls
D.Monitor token usage and set up alerts to stay within service limits
E.Resubscribe to the model endpoint if errors occur
AnswersA, C, D

Exponential backoff is a standard approach to handle rate limits by retrying after increasing delays.

Why this answer

A is correct because HTTP 429 (Too Many Requests) responses indicate rate limiting by the API provider. Implementing retry logic with exponential backoff is a standard resilience pattern that progressively increases wait times between retries, preventing further rate limit violations and allowing the system to recover gracefully without overwhelming the endpoint.

Exam trap

The 1Z0-1127 exam often tests the distinction between strategies that directly address API rate limiting (retry logic, caching, monitoring) versus unrelated configuration parameters like chunk_size, which candidates may mistakenly associate with performance tuning.

60
MCQhard

A team is building a conversational chatbot using LangChain and OCI Generative AI. They want to maintain a summary of the conversation rather than storing the entire history, to keep within token limits. Which memory class should they use, and what additional step is required when initializing the memory?

A.ConversationBufferWindowMemory; set a window size
B.ConversationTokenBufferMemory; set a token limit
C.ConversationSummaryMemory; provide an LLM to generate summaries
D.ConversationBufferMemory; no additional step
AnswerC

SummaryMemory needs an LLM to compress the conversation into a summary.

Why this answer

ConversationSummaryMemory is designed to maintain a running summary of the conversation instead of storing the full history, which directly addresses the requirement to stay within token limits. The additional step required is providing an LLM (e.g., via `llm=ChatOpenAI(...)`) because the memory class uses the LLM to generate and update the summary dynamically.

Exam trap

The 1Z0-1127 exam often tests the distinction between memory classes that truncate versus those that summarize, and the trap here is that candidates may confuse ConversationTokenBufferMemory (which drops messages) with summary-based memory, missing the critical requirement to provide an LLM for summary generation.

How to eliminate wrong answers

Option A is wrong because ConversationBufferWindowMemory keeps a fixed window of recent messages, not a summary, so it still stores raw history and does not reduce token usage beyond the window size. Option B is wrong because ConversationTokenBufferMemory drops messages when a token limit is exceeded, but it does not summarize; it simply truncates the history, losing context. Option D is wrong because ConversationBufferMemory stores the entire conversation history verbatim, which would exceed token limits and requires no additional step, making it unsuitable for the stated goal.

61
MCQmedium

A company wants to build a customer service chatbot that answers questions about their internal policy documents. The documents are updated monthly, and the team cannot afford to retrain a model each time. Which approach is MOST appropriate?

A.Use a larger foundation model with a longer context window and paste all documents into each prompt
B.Train a custom model from scratch on the policy documents each month
C.Fine-tune a base LLM on the policy documents monthly
D.Use Retrieval-Augmented Generation (RAG) with the policy documents indexed in a vector store
AnswerD

RAG retrieves relevant document chunks at query time, ensuring the chatbot always answers from the latest uploaded documents without any model retraining.

Why this answer

RAG (Retrieval-Augmented Generation) allows the LLM to retrieve relevant document sections at inference time, so knowledge stays current without retraining. The other options either require expensive retraining for each update or lack document grounding.

62
MCQhard

In a LangChain RAG pipeline using Oracle AI Vector Search, the developer wants to retrieve chunks that are both relevant and diverse to cover multiple aspects of a query. Which retrieval method should they configure on the retriever?

A.Threshold-based search
B.Maximal Marginal Relevance (MMR)
C.Random sampling of the top-k results
D.Similarity search with a high k value
AnswerB

MMR balances relevance and diversity by iteratively selecting documents that are dissimilar to already chosen ones.

Why this answer

Maximal Marginal Relevance (MMR) is the correct retrieval method because it explicitly balances relevance to the query with diversity among the retrieved chunks. In a LangChain RAG pipeline using Oracle AI Vector Search, MMR re-ranks the initial similarity results to minimize redundancy, ensuring the final set covers multiple aspects of the query rather than returning near-duplicate chunks.

Exam trap

The 1Z0-1127 exam often tests the misconception that simply increasing k or using a threshold will naturally yield diverse results, but candidates fail to recognize that without an explicit diversity mechanism like MMR, similarity-based retrievers inherently favor redundancy over coverage.

How to eliminate wrong answers

Option A is wrong because threshold-based search returns all chunks above a similarity score cutoff, which can still produce redundant results and does not enforce diversity. Option C is wrong because random sampling of the top-k results ignores relevance entirely, potentially returning irrelevant chunks and defeating the purpose of a RAG pipeline. Option D is wrong because similarity search with a high k value simply retrieves more chunks based on similarity, but without any diversity mechanism, it often returns clusters of near-identical content, failing to cover multiple query aspects.

63
MCQmedium

A developer notices that the ConversationalRetrievalChain in their LangChain application is not retaining context from previous turns in the conversation. Which component is most likely missing or misconfigured?

A.A document splitter to chunk the history
B.A retriever with appropriate search parameters
C.An embedding model to vectorize the history
D.A memory component like ConversationBufferMemory
AnswerD

Memory stores the conversation history and injects it into the prompt, enabling context retention.

Why this answer

ConversationalRetrievalChain requires a Memory component to store and retrieve chat history. Without Memory, the chain treats each query independently. The retriever, document splitter, and embeddings are responsible for retrieval and storage, not conversation history.

64
MCQmedium

A developer wants to use LangChain to create an agent that can perform calculations and look up information from a database. Which tools should be provided to the agent?

A.Custom tool for database queries and a vector store tool
B.Calculator tool and a custom tool for database queries
C.Calculator tool and a retriever tool
D.Web search tool and an LLM tool
AnswerB

The agent needs a calculator for math and a custom tool to run SQL queries.

Why this answer

A calculator tool handles arithmetic, and a custom tool can be created to query the database. Web search is not needed, and an LLM is not a tool but the underlying model.

65
MCQeasy

Which LangChain document loader would be most appropriate to load content from a public website for inclusion in a knowledge base?

A.PDFLoader
B.CSVLoader
C.TextLoader
D.WebBaseLoader
AnswerD

WebBaseLoader fetches content from a given URL and loads it as a Document.

Why this answer

WebBaseLoader is specifically designed to load documents from web URLs, fetching the HTML content and converting it to LangChain Document objects. PDFLoader, CSVLoader, and TextLoader are for local files of specific formats.

Ready to test yourself?

Try a timed practice session using only LangChain and AI Application Development questions.