CCNA Oci Genai Langchain Questions

75 of 90 questions · Page 1/2 · Oci Genai Langchain topic · Answers revealed

1
Multi-Selecteasy

A developer wants to load a CSV file containing customer feedback and split it into chunks for a RAG pipeline. Which TWO LangChain components should they use?

Select 3 answers
A.PDFLoader
B.TextLoader
C.TokenTextSplitter
D.CSVLoader
E.TextSplitter
AnswersC, D, E

TokenTextSplitter is a valid option but any text splitter works; the question asks for TWO components: a loader and a splitter.

Why this answer

Option C (TokenTextSplitter) is correct because it splits text into chunks based on token count, which is essential for RAG pipelines to ensure each chunk fits within the context window of an LLM. Option D (CSVLoader) is correct because it is specifically designed to load CSV files, making it the appropriate choice for ingesting the customer feedback data.

Exam trap

Cisco often tests the distinction between abstract base classes (TextSplitter) and concrete implementations (TokenTextSplitter), leading candidates to select the generic option when a specific one is required.

2
MCQhard

A developer observes that their LangChain RAG pipeline sometimes returns duplicate or near-duplicate documents in the retrieved set, reducing the diversity of information provided to the LLM. Which retrieval parameter should they adjust to improve diversity?

A.Increase the similarity score threshold
B.Increase chunk_overlap in the text splitter
C.Use MMR (maximum marginal relevance) as the search type
D.Reduce chunk_size in the text splitter
AnswerC

MMR explicitly penalizes similarity to already selected documents, promoting a more diverse result set.

Why this answer

MMR (Maximum Marginal Relevance) is a retrieval algorithm that balances relevance with diversity by re-ranking documents based on their similarity to the query and their dissimilarity to already-selected documents. By adjusting the lambda parameter, you control the trade-off between relevance and diversity, directly addressing the problem of duplicate or near-duplicate documents in the retrieved set.

Exam trap

Cisco often tests the misconception that adjusting chunk size or overlap can solve retrieval diversity issues, when in fact those parameters affect text splitting, not the retrieval algorithm's ability to select diverse results.

How to eliminate wrong answers

Option A is wrong because increasing the similarity score threshold will only filter out documents below a relevance cutoff, which does not prevent duplicates or near-duplicates that are all highly relevant. Option B is wrong because chunk_overlap controls the overlap between consecutive text chunks during splitting, affecting context continuity but not retrieval diversity. Option D is wrong because reducing chunk_size changes the granularity of document chunks, which may affect retrieval accuracy but does not introduce a diversity mechanism like MMR does.

3
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.

4
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

Cisco 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.

5
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.

6
MCQeasy

In a LangChain RetrievalQA chain, which method on a vector store is used to create the retriever object?

A.build_retriever()
B.to_retriever()
C.get_retriever()
D.as_retriever()
AnswerD

as_retriever() is the standard method to obtain a retriever from a vector store.

Why this answer

In LangChain, the `as_retriever()` method on a vector store object converts the vector store into a retriever object that can be used in a RetrievalQA chain. This method is part of the base `VectorStore` class and returns a `VectorStoreRetriever` instance, which wraps the vector store's similarity search functionality into a retriever interface compatible with LangChain's retrieval chains.

Exam trap

Cisco often tests the exact method name `as_retriever()` versus plausible-sounding alternatives like `to_retriever()` or `get_retriever()`, exploiting the common pattern of 'to_' or 'get_' prefixes in other frameworks to mislead candidates.

How to eliminate wrong answers

Option A is wrong because `build_retriever()` is not a method defined on any LangChain vector store class; it does not exist in the LangChain API. Option B is wrong because `to_retriever()` is not a valid method; LangChain uses `as_retriever()` as the standard conversion method. Option C is wrong because `get_retriever()` is not a method on vector stores; while some LangChain components have `get_retriever()` methods (e.g., certain index wrappers), the vector store itself exposes `as_retriever()` for this purpose.

7
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.

8
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.

9
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.

10
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.

11
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

Cisco 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.

12
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.

13
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.

14
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.

15
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

Option D is correct because 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.

16
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.

17
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

Option C is correct because 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

Cisco 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.

18
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

Cisco 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.

19
Multi-Selectmedium

A developer is deploying a LangChain agent that uses an LLM from OCI Generative AI. The agent interacts with external APIs and must handle rate limits gracefully. Which TWO practices should the developer implement?

Select 2 answers
A.Disable caching to ensure fresh responses
B.Increase the max_tokens parameter to reduce the number of calls
C.Implement retry logic with exponential backoff for API calls
D.Set the model temperature to 0
E.Use a rate limiter to control the frequency of API requests
AnswersC, E

Retry with backoff reduces load on the API and allows recovery from transient rate limit errors.

Why this answer

Implementing retry logic with exponential backoff (A) and using a rate limiter (D) are standard practices to handle rate limits. Disabling caching (B) would increase load, and increasing max_tokens (C) affects response length, not rate limits. Setting temperature to 0 (E) affects creativity, not rate limits.

20
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.

21
MCQhard

An organization using Oracle AI Vector Search for a RAG application wants to minimize latency for vector similarity searches on a dataset of 10 million vectors. Which index type and parameter combination is MOST likely to achieve the lowest latency while maintaining high recall?

A.IVF with quantization and probes=5
B.HNSW with neighbors=32
C.HNSW with neighbors=64
D.IVF with probes=10
AnswerC

HNSW with a higher neighbor count provides excellent recall with minimal latency overhead, often outperforming IVF for large datasets.

Why this answer

HNSW (Hierarchical Navigable Small World) graphs are designed for low-latency approximate nearest neighbor (ANN) search, and increasing the number of neighbors (efConstruction/efSearch) directly improves recall at the cost of memory. With 10 million vectors, HNSW with neighbors=64 provides a denser graph, reducing the number of hops during search and achieving lower latency than IVF-based methods, which require scanning multiple clusters. This combination offers the best trade-off for high recall and minimal latency in a RAG application.

Exam trap

Cisco often tests the misconception that IVF with more probes always reduces latency, when in fact HNSW's graph-based approach inherently provides lower latency for large-scale vector search due to its logarithmic search complexity.

How to eliminate wrong answers

Option A is wrong because IVF with quantization and probes=5 reduces memory but introduces quantization error and requires scanning 5 clusters, which increases latency compared to HNSW's direct graph traversal. Option B is wrong because HNSW with neighbors=32 creates a sparser graph, leading to more hops and higher latency for 10 million vectors, while neighbors=64 provides a denser graph for faster convergence. Option D is wrong because IVF with probes=10 still requires scanning 10 clusters, which is slower than HNSW's logarithmic search complexity, and lacks the quantization that could reduce memory but not latency.

22
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.

23
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.

24
MCQmedium

A developer wants to create a LangChain chain that takes a user's question, retrieves relevant documents from a vector store, and then generates an answer using an LLM. Which chain is MOST appropriate for this task?

A.ConversationalRetrievalChain
B.SequentialChain
C.LLMChain
D.RetrievalQAChain
AnswerD

RetrievalQAChain combines a retriever and an LLM chain, suitable for RAG-style question answering.

Why this answer

RetrievalQAChain is specifically designed for question-answering over a vector store: it takes a user query, retrieves relevant documents from the vector store, and passes them as context to an LLM to generate an answer. This matches the developer's requirement exactly, without any extra conversational memory or multi-step orchestration.

Exam trap

Cisco often tests the distinction between single-turn RAG (RetrievalQAChain) and multi-turn conversational RAG (ConversationalRetrievalChain), so candidates mistakenly choose the conversational variant when the question explicitly describes a single user question without any chat history requirement.

How to eliminate wrong answers

Option A is wrong because ConversationalRetrievalChain adds conversational memory to maintain chat history, which is unnecessary for a single-turn question-answering task and introduces overhead. Option B is wrong because SequentialChain is used for chaining multiple independent steps in a fixed sequence, not for retrieval-augmented generation (RAG) with a vector store. Option C is wrong because LLMChain only calls an LLM with a prompt template and does not include any document retrieval from a vector store.

25
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

Cisco 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.

26
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

Cisco 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.

27
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.

28
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

Cisco 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.

29
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

Option B is correct because 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

Cisco 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.

30
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.

31
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.

32
MCQhard

An application uses Oracle AI Vector Search with a VECTOR data type column. The team wants to perform a similarity search to find the top 5 most similar vectors to a query vector. Which SQL clause is necessary to achieve this?

A.WHERE embedding SIMILAR TO :query_vec TOP 5
B.ORDER BY VECTOR_COMPARE(embedding, :query_vec) LIMIT 5
C.WHERE KNN(embedding, :query_vec, 5)
D.ORDER BY VECTOR_DISTANCE(embedding, :query_vec) FETCH FIRST 5 ROWS ONLY
AnswerD

This orders rows by vector distance and returns the top 5 nearest neighbors.

Why this answer

Option D is correct because Oracle AI Vector Search uses the VECTOR_DISTANCE function to compute the distance between vectors, and the FETCH FIRST 5 ROWS ONLY clause limits the result set to the top 5 most similar vectors. This combination performs an exact nearest neighbor search, which is the standard SQL approach for similarity queries on a VECTOR column.

Exam trap

Cisco often tests the distinction between exact SQL syntax and conceptual algorithm names, so the trap here is that candidates might confuse the KNN algorithm name with an actual SQL clause or function, or incorrectly assume LIMIT is valid in Oracle SQL.

How to eliminate wrong answers

Option A is wrong because SIMILAR TO is not a valid SQL operator for vector similarity in Oracle; it is a pattern-matching operator for strings. Option B is wrong because VECTOR_COMPARE is not a valid Oracle function; the correct function is VECTOR_DISTANCE, and LIMIT is not valid Oracle SQL syntax (FETCH FIRST is used instead). Option C is wrong because KNN is not a SQL clause in Oracle; it is a conceptual algorithm name, and Oracle does not support a KNN() function in SQL.

33
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.

34
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.

35
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.

36
MCQeasy

Which LangChain document loader would you use to load data from a webpage given its URL?

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

WebBaseLoader loads and parses HTML content from URLs.

Why this answer

A is correct because WebBaseLoader is specifically designed in LangChain to load and parse HTML content from a given URL, extracting text from web pages. It uses libraries like BeautifulSoup or Selenium under the hood to handle the HTTP request and parse the DOM, making it the appropriate choice for loading data from a webpage.

Exam trap

Cisco often tests the distinction between loaders that handle local files (PDFLoader, CSVLoader, TextLoader) versus those that fetch remote content (WebBaseLoader), trapping candidates who assume any loader can accept a URL.

How to eliminate wrong answers

Option B is wrong because PDFLoader is used to load data from PDF files, not from web pages; it parses PDF binary format and extracts text, but cannot fetch content from a URL. Option C is wrong because CSVLoader is designed to load structured data from CSV files, handling delimiters and rows, but it cannot interpret a URL or fetch web content. Option D is wrong because TextLoader loads plain text files from a local file system path, not from a remote URL; it lacks the HTTP client and HTML parsing capabilities needed for web pages.

37
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.

38
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

Option A is correct because 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.

39
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.

40
MCQmedium

A developer wants to ensure that a LangChain RetrievalQA chain returns diverse results, avoiding near-duplicate passages in the retrieved context. Which retrieval parameter should be configured on the retriever?

A.top_k
B.similarity_search
C.Maximum Marginal Relevance (MMR)
D.chunk_overlap
AnswerC

MMR balances relevance and diversity, reducing redundancy among retrieved chunks.

Why this answer

Option C is correct because Maximum Marginal Relevance (MMR) is specifically designed to reduce redundancy by balancing relevance with diversity. When configured on a retriever, MMR selects documents that are both relevant to the query and dissimilar to each other, thus avoiding near-duplicate passages in the retrieved context.

Exam trap

Cisco often tests the distinction between retrieval parameters that control quantity (top_k) versus those that control quality/diversity (MMR), and candidates mistakenly assume that increasing top_k alone will provide diverse results.

How to eliminate wrong answers

Option A is wrong because top_k only controls the number of documents returned from the retriever, not their diversity; it can still return near-duplicate passages. Option B is wrong because similarity_search is a method that retrieves documents based on cosine similarity to the query, which inherently favors the most similar documents and can return redundant results. Option D is wrong because chunk_overlap is a parameter for splitting documents into chunks (e.g., in text splitters), not a retrieval parameter, and does not affect diversity in retrieval.

41
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.

42
MCQhard

A company is deploying a LangChain agent for internal data analysis. The agent uses a ReAct pattern with tools including a Python REPL and a SQL query tool. What is the PRIMARY security concern when exposing this agent to non-technical users?

A.Model hallucination when generating SQL queries
B.Prompt injection leading to incorrect SQL queries
C.Data leakage through the SQL query tool
D.Arbitrary code execution via the Python REPL tool
AnswerD

A Python REPL allows executing arbitrary Python code, which an attacker could exploit to run system commands, access files, or pivot.

Why this answer

The Python REPL tool allows the agent to execute arbitrary Python code on the host system. When exposed to non-technical users, an attacker can craft prompts that cause the agent to run malicious code, leading to full remote code execution, data exfiltration, or system compromise. This is the most severe risk because it bypasses all data access controls and directly impacts the underlying infrastructure.

Exam trap

Cisco often tests the distinction between data-level risks (SQL injection, data leakage) and system-level risks (code execution), and the trap here is that candidates focus on the more familiar SQL injection or data leakage threats while underestimating the catastrophic impact of an unrestricted Python REPL tool.

How to eliminate wrong answers

Option A is wrong because model hallucination in SQL generation is a correctness and reliability issue, not a primary security concern; it can produce wrong results but does not directly enable system compromise. Option B is wrong because prompt injection leading to incorrect SQL queries is a form of manipulation that could cause data corruption or unauthorized data access, but it is less severe than arbitrary code execution and is often mitigated by query parameterization and input validation. Option C is wrong because data leakage through the SQL query tool is a valid concern, but it is a data-level risk that can be contained with proper access controls and auditing, whereas the Python REPL tool introduces a system-level vulnerability that can bypass all such controls.

43
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.

44
MCQmedium

A team is using LangChain's LCEL to build a RAG pipeline. They want to add a step that logs the retrieved documents before passing them to the LLM. How can they achieve this while keeping the chain composable?

A.Insert a RunnableLambda that logs the documents and passes them through
B.Use a callback handler attached to the LLM to capture input documents
C.Add a separate logging service that intercepts the chain's output
D.Modify the retriever's internal code to add logging
AnswerA

RunnableLambda wraps a function that logs and returns the documents unchanged, fitting cleanly in the LCEL pipeline.

Why this answer

Option A is correct because `RunnableLambda` in LangChain's LCEL allows you to inject a custom function that logs the documents and then returns them unchanged, preserving the chain's composability. This pattern keeps the pipeline modular and testable without modifying the retriever or LLM internals.

Exam trap

Cisco often tests the distinction between intercepting data at different pipeline stages (retrieval vs. LLM input vs. output), and the trap here is assuming that callback handlers or output interceptors can capture intermediate retrieval results when they are designed for different lifecycle events.

How to eliminate wrong answers

Option B is wrong because callback handlers attached to the LLM capture inputs to the LLM, not the documents retrieved before the LLM step; they would log the LLM's prompt, not the raw retrieved documents. Option C is wrong because a separate logging service intercepting the chain's output would log the final answer, not the intermediate retrieved documents, and it breaks the composable flow of LCEL. Option D is wrong because modifying the retriever's internal code violates the principle of separation of concerns and makes the chain less maintainable and reusable.

45
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.

46
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.

47
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.

48
Multi-Selectmedium

A developer is using LangChain's RetrievalQA chain with a vector store. They want to improve the diversity of retrieved documents to avoid redundant information. Which TWO parameters or methods should they adjust?

Select 2 answers
A.Increase the 'chunk_size' in the text splitter
B.Set the 'k' parameter to a very high number
C.Use a different embedding model
D.Set the 'fetch_k' parameter to a value larger than 'k'
E.Enable MMR (maximum marginal relevance) in the retriever
AnswersD, E

fetch_k retrieves a larger initial set from which MMR can choose a diverse subset.

Why this answer

Option D is correct because setting 'fetch_k' to a value larger than 'k' allows the retriever to first fetch a larger pool of candidate documents (fetch_k) and then apply a diversity-promoting algorithm like MMR to select the final 'k' documents. This reduces redundancy by ensuring the returned set is not dominated by similar documents from the same region of the vector space.

Exam trap

Cisco often tests the misconception that simply increasing the number of retrieved documents (k) improves diversity, when in fact without MMR or a similar algorithm, more documents often means more redundancy.

49
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.

50
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.

51
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.

52
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.

53
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.

54
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.

55
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.

56
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.

57
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.

58
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.

59
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.

60
Multi-Selecthard

A developer is using LangChain with Oracle AI Vector Search (OracleVS) to store embeddings. They notice that similarity search queries are slow. Which THREE actions could improve query performance?

Select 3 answers
A.Reduce the chunk_size parameter in the text splitter
B.Switch from HNSW to IVF with a low number of centroids
C.Use a smaller embedding model (e.g., 384 dimensions instead of 1536)
D.Create an HNSW vector index on the VECTOR column
E.Increase the efSearch parameter in the HNSW index
AnswersC, D, E

Lower-dimensional vectors reduce memory bandwidth and comparison cost, improving speed.

Why this answer

Option C is correct because using a smaller embedding model (e.g., 384 dimensions instead of 1536) reduces the size of each vector stored in Oracle AI Vector Search. This directly decreases memory bandwidth and storage I/O during similarity search, leading to faster distance computations and overall query performance, especially when combined with an index.

Exam trap

Cisco often tests the misconception that increasing index parameters like efSearch always improves performance, when in fact it increases computational overhead and may slow queries if not balanced with recall requirements.

61
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

Cisco often tests the misconception 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.

62
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

Option D is correct because 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.

63
Multi-Selecteasy

A developer wants to persist chat history for a LangChain application so that conversations survive application restarts. Which TWO approaches are appropriate?

Select 2 answers
A.Use a Python dictionary as the memory store
B.Store messages in a database and load them on startup
C.Use AgentExecutor with a custom tool for history
D.Save the conversation to a local .txt file
E.Use Redis as a backend for ConversationBufferMemory
AnswersB, E

A database provides durable storage; messages can be reloaded into memory when the app restarts.

Why this answer

Option B is correct because storing messages in a database (e.g., SQLite, PostgreSQL) and loading them on startup provides durable, persistent storage that survives application restarts. This approach decouples conversation history from the application's in-memory state, ensuring data is not lost when the process terminates. LangChain's memory classes like `ConversationBufferMemory` can be initialized with a `chat_memory` parameter backed by a database, enabling seamless restoration of history.

Exam trap

Cisco often tests the distinction between ephemeral in-memory storage (like a Python dict) and durable persistence mechanisms (like databases or Redis with persistence enabled), trapping candidates who assume any file-based or in-memory solution is sufficient for restart survival.

64
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.

65
Multi-Selectmedium

A developer is using LangChain to build a RAG pipeline that processes PDF documents. They need to split the text into chunks and store embeddings in Oracle Database 23ai. Which two components are essential? (Choose TWO.)

Select 2 answers
A.WebBaseLoader
B.RecursiveCharacterTextSplitter
C.OCIGenAIEmbeddings
D.OracleVS
E.OCIGenAI
AnswersB, D

This splitter is commonly used to break PDF text into manageable chunks for embedding.

Why this answer

RecursiveCharacterTextSplitter is used to split documents into chunks, and OracleVS is the LangChain wrapper for Oracle AI Vector Search to store embeddings and perform similarity search. The other options are either not essential (WebBaseLoader loads web pages, not PDFs) or not for storage (OCIGenAI is an LLM wrapper).

66
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.

67
Multi-Selectmedium

A developer is building a RAG application with LangChain and Oracle AI Vector Search. They need to choose a text splitter that respects semantic boundaries (e.g., paragraphs, sentences) and a vector store that supports transactional updates in Oracle Database 23ai. Which TWO options should they select?

Select 2 answers
A.OracleVS
B.FAISS
C.CharacterTextSplitter
D.TokenTextSplitter
E.RecursiveCharacterTextSplitter
AnswersA, E

OracleVS wraps Oracle AI Vector Search, providing transactional vector storage in Oracle Database.

Why this answer

OracleVS (Option A) is correct because it is the LangChain vector store integration specifically designed for Oracle Database 23ai, supporting transactional updates (INSERT, UPDATE, DELETE) via the Oracle AI Vector Search feature. This allows the RAG application to maintain consistency with ACID properties when modifying vector embeddings.

Exam trap

Cisco often tests the distinction between text splitters that respect semantic boundaries (RecursiveCharacterTextSplitter) versus those that split purely by character or token count, and between vector stores with transactional database support (OracleVS) versus in-memory or non-transactional stores (FAISS).

68
MCQeasy

A developer wants to use LangChain to connect to OCI Generative AI Service for text generation. Which LangChain wrapper class should they use for the chat model?

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

ChatOCIGenAI is specifically designed for chat models and supports messages, roles, and conversation context.

Why this answer

ChatOCIGenAI is the correct LangChain wrapper class for chat-based interactions with OCI Generative AI Service. LangChain distinguishes between standard LLM wrappers (OCIGenAI) and chat model wrappers (ChatOCIGenAI), where the latter is designed to handle multi-turn conversation history and structured message formats (HumanMessage, AIMessage, SystemMessage). This aligns with the developer's requirement for a chat model.

Exam trap

Cisco often tests the distinction between LLM and ChatModel wrappers in LangChain, trapping candidates who assume all text generation tasks use the same class, or who confuse OCI-specific wrappers with generic OpenAI ones.

How to eliminate wrong answers

Option A is wrong because OCIGenAI is the base LangChain wrapper for OCI Generative AI Service's text generation (LLM), not the chat-specific variant; it lacks built-in support for chat message history and roles. Option C is wrong because ChatOpenAI is a wrapper for OpenAI's chat models (e.g., GPT-3.5/GPT-4), not for OCI Generative AI Service; using it would require different API keys and endpoints. Option D is wrong because OCIGenAIEmbeddings is a wrapper for generating embeddings (vector representations of text), not for text generation or chat; it serves a completely different purpose in RAG or similarity search pipelines.

69
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 3 answers
A.AIMessage
B.SystemMessage
C.MessagesPlaceholder with variable name 'history'
D.HumanMessage
AnswersB, C, D

A system message sets the behavior or context for the model.

Why this answer

Option B is correct because `SystemMessage` is the LangChain class used to define the system-level instruction that sets the behavior and context for the conversational agent. In a `ChatPromptTemplate`, the system message is typically the first message in the prompt, providing overarching guidance to the model before any conversation history or user input is added.

Exam trap

Cisco often tests 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.

70
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.Fine-tune a base LLM on the policy documents monthly
C.Use Retrieval-Augmented Generation (RAG) with the policy documents indexed in a vector store
D.Train a custom model from scratch on the policy documents each month
AnswerC

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

Option C is correct because Retrieval-Augmented Generation (RAG) allows the chatbot to answer questions from dynamic policy documents without retraining. By indexing the documents in a vector store and retrieving relevant chunks at query time, the system can handle monthly updates simply by re-indexing the new documents, keeping the LLM's weights unchanged.

Exam trap

Cisco often tests the misconception that fine-tuning is the only way to incorporate custom data, but the trap here is that RAG provides a cheaper, more flexible alternative for frequently updated documents without modifying the model.

How to eliminate wrong answers

Option A is wrong because pasting all documents into each prompt would exceed the context window limits of even the largest foundation models (e.g., 128K tokens for GPT-4 Turbo), leading to truncation, high latency, and increased cost per query. Option B is wrong because fine-tuning a base LLM monthly on the policy documents is expensive, time-consuming, and still requires retraining each time the documents change, which the team explicitly cannot afford. Option D is wrong because training a custom model from scratch each month is prohibitively costly and resource-intensive, requiring massive datasets, GPU hours, and ML expertise, far beyond the scope of a simple chatbot.

71
Multi-Selecthard

A LangChain ReAct agent is failing to correctly use a custom tool that requires a specific parameter format. The agent keeps calling the tool with incorrect parameters. Which THREE steps should the developer take to debug and fix the issue?

Select 3 answers
A.Check the model's token limit
B.Enable verbose logging in the AgentExecutor to see the agent's reasoning steps
C.Test the agent with a minimal example that only uses the problematic tool
D.Improve the tool's description and parameter schema in the tool definition
E.Increase the chunk size in the text splitter
AnswersB, C, D

Verbose mode shows the agent's thoughts and actions.

Why this answer

Option B is correct because enabling verbose logging in the AgentExecutor (by setting `verbose=True`) prints the full chain-of-thought reasoning steps the ReAct agent generates before calling a tool. This allows the developer to see exactly what parameters the LLM is constructing and why it deviates from the expected format, making it the first step in diagnosing the misconfiguration.

Exam trap

Cisco often tests the distinction between debugging agent reasoning (verbose logging) and unrelated hyperparameters (token limits, chunk sizes) to see if candidates understand the ReAct agent's internal execution flow versus general LLM or RAG configuration.

72
Multi-Selectmedium

A team is designing a production-grade LangChain agent that uses multiple tools, including a custom SQL query tool and a web search tool. They need to ensure the agent handles errors gracefully and logs all actions. Which three practices should they implement? (Choose THREE.)

Select 3 answers
A.Use AgentType.ZERO_SHOT_REACT_DESCRIPTION to simplify the agent's reasoning
B.Set max_iterations in AgentExecutor to limit the number of reasoning steps and avoid infinite loops
C.Wrap each tool's execution in try-except blocks to catch exceptions and return meaningful error messages
D.Set verbose=True in the AgentExecutor to show all reasoning steps to end users
E.Add a custom callback handler to log tool inputs and outputs for monitoring
AnswersB, C, E

Limiting iterations prevents the agent from getting stuck in a loop, a common production issue.

Why this answer

Option B is correct because setting `max_iterations` in `AgentExecutor` prevents infinite loops by capping the number of reasoning steps the agent can take. In production, an agent might repeatedly call tools without converging on a final answer, consuming resources and causing timeouts. This parameter directly enforces a hard stop, which is essential for reliability.

Exam trap

Cisco often tests the distinction between debugging features (like `verbose=True`) and production-grade logging (like custom callback handlers), leading candidates to mistakenly choose `verbose=True` as a valid logging practice for end users.

73
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'.

74
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

Cisco 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.

75
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.

Page 1 of 2 · 90 questions totalNext →

Ready to test yourself?

Try a timed practice session using only Oci Genai Langchain questions.

CCNA Oci Genai Langchain Questions — Page 1 of 2 | Courseiva