CCNA Oci Genai Prompt Engineering Questions

75 of 120 questions · Page 1/2 · Oci Genai Prompt Engineering topic · Answers revealed

1
MCQmedium

A prompt engineer is designing a system prompt for a customer support agent. The goal is to ensure the agent always responds in a polite, professional tone and never provides medical advice. Which approach best achieves this?

A.Set the temperature to 0 to ensure consistent tone and hope it avoids medical topics
B.Specify tone in the system prompt and add the medical advice restriction in each user message
C.Rely on the model's inherent training to avoid medical advice, so no explicit instruction needed
D.Use a system prompt that includes both the desired tone and the constraint about medical advice
AnswerD

System prompt is the proper place for global instructions about persona, tone, and constraints.

Why this answer

System prompt is designed to set persona, tone, and constraints. Including both tone and constraints in the system prompt is the intended practice.

2
MCQmedium

A developer needs to extract structured data from news articles in JSON format, but the model occasionally outputs extra fields or omits required fields. Which prompt engineering approach would MOST reliably enforce the exact schema?

A.Use a few-shot example of the desired JSON output
B.Specify the exact JSON schema in the task instruction and include constraints such as required fields
C.Lower the temperature to 0 to make output deterministic
D.Use chain-of-thought prompting to reason about the article before outputting JSON
AnswerB

Explicit schema and constraints in the prompt give the clearest guidance.

Why this answer

Providing a JSON schema with explicit instructions and constraints directly in the prompt is the most reliable way to enforce exact structure.

3
MCQeasy

A prompt engineering team is designing a system prompt for a chatbot that should adopt a professional and concise tone. Which prompt pattern is BEST suited for this requirement?

A.Role prompting in the system message: 'You are a professional customer support agent. Respond concisely and accurately.'
B.Chain-of-thought prompting to ensure reasoning before answering
C.Zero-shot prompting with a direct instruction in the user message
D.Few-shot prompting with examples of professional responses in the user message
AnswerA

Role prompting in the system message establishes the persona and tone across all interactions.

Why this answer

Role prompting explicitly sets the persona (e.g., 'You are an expert customer support agent') which guides tone and behavior. The system message is the ideal place for this.

4
Multi-Selectmedium

A prompt engineer is refining a prompt that currently produces outputs with excessive repetition. Which TWO parameters can be adjusted to reduce repetition? (Choose two.)

Select 2 answers
A.Temperature
B.Frequency penalty
C.Presence penalty
D.Max tokens
E.Top-p
AnswersB, C

Frequency penalty reduces the likelihood of repeating the same tokens.

Why this answer

Frequency penalty discourages tokens that have already appeared, and presence penalty discourages tokens that have appeared at all. Both reduce repetition. Temperature and max tokens do not directly target repetition.

5
MCQmedium

Which prompt pattern is most suitable when a user needs to generate a structured report following a specific template every time?

A.Recipe pattern
B.Template pattern
C.ReAct pattern
D.Role prompting
AnswerB

Template pattern provides a structured form with placeholders, ideal for consistent report generation.

Why this answer

Template patterns provide a fixed structure (e.g., fill-in-the-blanks) that the model follows, ensuring consistent output format.

6
MCQhard

When using Cohere Command models on OCI Generative AI, a developer wants to ground a response based on a provided document. Which syntax should be used to embed document content in the prompt?

A.{{document}} ... {{/document}}
B.[DOC] ... [/DOC]
C.document: ... <end_document>
D.<|document|> ... <|/document|>
AnswerC

Cohere Command uses the 'document:' prefix and '<end_document>' marker to specify document content.

Why this answer

Cohere Command models support a special document-grounded generation syntax using the 'document:' prefix. This tells the model to treat the following text as a reference document for grounding.

7
MCQmedium

A team wants to use a prompt pattern that combines reasoning with acting, where the model alternates between thinking and taking actions (e.g., tool calls). Which pattern fits this requirement?

A.ReAct pattern
B.Template pattern
C.Role prompting
D.Recipe pattern
AnswerA

ReAct explicitly interleaves reasoning traces with actions (e.g., tool use).

Why this answer

The ReAct pattern (Reason + Act) prompts the model to output reasoning steps and then perform actions (like API calls), enabling interactive problem-solving.

8
MCQmedium

A data scientist wants to generate a response that lists top-3 product features in a bulleted format with no introductory text. Which prompt engineering technique should be used?

A.Set temperature to 0 to ensure deterministic output
B.Provide few-shot examples of desired output
C.Use chain-of-thought prompting
D.Include a clear task instruction specifying the format
AnswerD

Directly instructing the model to output a bulleted list without intro text is the most straightforward technique.

Why this answer

Specifying the output format (bulleted list, no intro text) directly in the instruction is the most straightforward way to control the structure. Few-shot examples could also work but are unnecessary when a clear instruction suffices.

9
MCQmedium

A team is prompting a model to translate English to French. They notice the model occasionally mixes French with other Romance languages. Which prompt refinement strategy would MOST likely improve language consistency?

A.Add a constraint in the system prompt: 'Translate only to French. Do not use any other language.'
B.Use a stop sequence to halt after the first sentence
C.Lower top-k to 1 for deterministic output
D.Increase temperature to encourage more focused output
AnswerA

A clear constraint in the system prompt reduces ambiguity and prevents mixing.

Why this answer

Explicitly constraining the output to French only, with a clear prohibition against other languages, directly addresses language mixing.

10
MCQmedium

A team wants to create a prompt library for their organization's LLM applications. Which practice is MOST important for maintaining prompt quality over time?

A.Version-control prompts and define evaluation metrics for each prompt variant
B.Store all prompts in a shared document without version history
C.Assign a single person to manage all prompts without review
D.Keep prompts only in the codebase without separate documentation
AnswerA

Versioning and evaluation metrics enable systematic refinement and accountability.

Why this answer

Versioning prompts and establishing evaluation criteria are key to tracking changes and ensuring quality. Without versioning, it's impossible to know which version produced which result.

11
MCQeasy

Which prompt engineering technique involves providing the model with a few input-output examples within the prompt to guide its response?

A.Tree-of-thought prompting
B.Zero-shot prompting
C.Few-shot prompting
D.Chain-of-thought prompting
AnswerC

Few-shot provides a few examples to guide the model.

Why this answer

Few-shot prompting (Option C) is the correct answer because it explicitly involves providing the model with a small set of input-output examples within the prompt to guide its response. This technique helps the model understand the desired task format, style, or reasoning pattern without requiring fine-tuning, leveraging in-context learning to adapt its output based on the provided demonstrations.

Exam trap

Cisco often tests the distinction between few-shot and zero-shot prompting, where candidates may confuse 'providing examples' with 'providing instructions' or 'step-by-step reasoning'—the trap is assuming that any example in the prompt qualifies as few-shot, when in fact the key is the explicit input-output pairs used to guide the response.

How to eliminate wrong answers

Option A is wrong because Tree-of-thought prompting guides the model to explore multiple reasoning paths or branches simultaneously, not by providing input-output examples. Option B is wrong because Zero-shot prompting asks the model to perform a task without any examples, relying solely on its pre-trained knowledge. Option D is wrong because Chain-of-thought prompting encourages step-by-step reasoning by including intermediate reasoning steps in the prompt, but it does not necessarily require multiple input-output examples; it often uses a single example or a reasoning template.

12
Multi-Selectmedium

A prompt engineer is designing a system to answer customer queries using OCI Generative AI. They want to ensure the model's responses are concise, accurate, and consistent. Which TWO prompt engineering practices should they implement? (Select two.)

Select 2 answers
A.Include a system prompt specifying 'You are a customer support agent. Answer concisely in two sentences.'
B.Remove any context from the prompt to avoid biasing the model
C.Use the tree-of-thought technique for every query
D.Use a low temperature (e.g., 0.1) for deterministic outputs
E.Set temperature to 0.9 to encourage creative responses
AnswersA, D

System prompt sets persona and length constraint.

Why this answer

Setting a low temperature reduces randomness (consistency). Including a system prompt with tone and length constraints directly addresses conciseness and format.

13
MCQhard

A developer uses a Cohere Command model with a preamble: 'You are a helpful assistant that answers questions based on the provided document.' They also include a user message with a query and a relevant document excerpt. However, the model often ignores the document and uses its own knowledge. Which improvement is MOST effective?

A.Use the document-grounded generation format with <doc> and </doc> tags around the document
B.Increase the temperature to 0.7 to reduce reliance on parametric knowledge
C.Set frequency penalty to 0.5
D.Remove the preamble and rely solely on the user message
AnswerA

Explicit document tags help the model distinguish between the query and the grounding document.

Why this answer

Cohere's document-grounded generation syntax uses special tags to clearly separate the document from the query, ensuring the model focuses on the provided content rather than its training data.

14
MCQeasy

Which prompting technique involves providing the model with a few examples of input-output pairs within the prompt to guide its behavior?

A.Zero-shot prompting
B.Few-shot prompting
C.Self-consistency prompting
D.Chain-of-thought prompting
AnswerB

Few-shot provides a handful of examples to guide the model.

Why this answer

Few-shot prompting includes several demonstrations of the desired task, helping the model understand the expected output format and reasoning.

15
MCQhard

A developer is using Cohere Command R+ via OCI Generative AI and wants to ground answers in a provided set of documents using the `documents` parameter. Which prompt structure ensures the model correctly adheres to the documents?

A.Use a preamble: 'You answer questions based only on the provided documents. If the answer is not in the documents, say you don't know.' Then pass documents via the `documents` parameter in the request
B.Set a system prompt that says 'You are a helpful assistant' and pass documents in the `documents` parameter with no further instruction
C.Place the documents in the conversation history as an assistant message before the user's question
D.Include the documents in the user message after the question
AnswerA

This matches Cohere's best practice: a clear preamble instruction plus the `documents` parameter.

Why this answer

Cohere's document-grounded generation requires the preamble to instruct the model to answer based solely on the documents, and the conversation history must include the documents in the correct format.

16
Multi-Selecthard

A prompt engineer is using the self-consistency technique to improve answer reliability. Which THREE steps are essential when implementing self-consistency?

Select 2 answers
A.Use tree-of-thought to explore all possible reasoning branches
B.Use a single chain-of-thought prompt to produce one reasoning path
C.Set temperature to 0 for reproducible outputs
D.Aggregate the outputs (e.g., by majority voting or marginalizing over reasoning steps) to select the most consistent answer
E.Generate multiple independent reasoning paths by running the prompt several times with a non-zero temperature
AnswersD, E

Aggregation is the core of self-consistency.

Why this answer

Self-consistency involves generating multiple reasoning paths, then selecting the most consistent answer. It does not require a single chain-of-thought or tree-of-thought expansion.

17
MCQhard

An AI engineer is designing a prompt that requires the model to solve a complex math problem. They want the model to explore multiple reasoning paths and then aggregate the final answer. Which prompting technique BEST fits this requirement?

A.Self-consistency prompting
B.Zero-shot prompting with a direct instruction
C.Tree-of-thought prompting
D.Few-shot prompting with worked examples
AnswerA

Self-consistency runs chain-of-thought multiple times and aggregates results for improved accuracy.

Why this answer

Self-consistency generates multiple reasoning paths (e.g., using chain-of-thought) and then takes a majority vote or averages results, which directly matches the need for multiple paths and aggregation.

18
Multi-Selectmedium

A data scientist is iteratively refining a prompt for a text classification task. Which TWO practices are essential for systematic prompt improvement?

Select 2 answers
A.Establishing clear evaluation criteria such as accuracy, F1, or human ratings
B.Using the same prompt on all inputs without variation
C.Randomly changing words in the prompt without tracking changes
D.A/B testing different prompt variants on a held-out evaluation set
E.Increasing temperature to generate more diverse outputs for the same prompt
AnswersA, D

Criteria are needed to measure success.

Why this answer

A/B testing helps compare prompt variants, and establishing evaluation criteria ensures objective measurement of improvements. The other options are either irrelevant or counterproductive.

19
MCQmedium

An engineer is using the ReAct pattern to build a reasoning agent. The agent should first reason about the user query, then call an external API, and finally incorporate the API result into a final answer. Which prompt structure best implements this pattern?

A."You have access to an API. For each step, output 'Thought:', then 'Action:', then 'Observation:' before the final answer."
B."You are a helpful assistant. Answer the user's question based on your knowledge."
C."First, call the API. Then, output the result."
D."Think step by step, then provide the final answer."
AnswerA

This matches the ReAct pattern: Thought, Action, Observation, then final answer.

Why this answer

ReAct explicitly interleaves reasoning (Thought) and actions (Action) before final output.

20
MCQhard

A prompt engineer is tasked with reducing hallucinations in a document-grounded generation task using Cohere Command R. Which system prompt component is MOST effective for enforcing that the model only uses provided documents?

A."You are an expert in the field. Use your extensive knowledge to answer."
B."Provide a detailed answer with references."
C."Use a temperature of 0.0 for factual answers."
D."Answer the question based solely on the provided document. If the document does not contain the answer, say 'I don't know'."
AnswerD

Clearly constrains the model to the document and provides a fallback response, reducing hallucinations.

Why this answer

Explicit instruction to base answers solely on provided context, with a constraint to say if information is missing, directly reduces hallucinations.

21
MCQhard

A developer is using the Cohere Command model to build a Q&A system that must ground answers in provided documents. Which syntax should be used to indicate the document text in the user message?

A.Append the document text after a '---' separator in the user message
B.Use the <results> tag in the user message to wrap the document text
C.Enclose the document text in <doc> tags within the preamble
D.Place the document text in the system prompt as a context parameter
AnswerB

Cohere Command uses <results> to insert search results or documents for grounding.

Why this answer

Cohere's document-grounded generation uses <results> tags to include document text.

22
MCQeasy

Which prompt engineering technique asks the model to explain its reasoning process step-by-step before arriving at the final answer?

A.Chain-of-thought prompting
B.Tree-of-thought prompting
C.Self-consistency
D.Zero-shot prompting
AnswerA

Chain-of-thought prompts the model to produce intermediate reasoning steps.

Why this answer

Chain-of-thought prompting explicitly instructs the model to think step by step, improving reasoning accuracy.

23
MCQmedium

A developer is using the ReAct pattern to build a reasoning agent. Which of the following best describes the two main steps in this pattern?

A.Retrieve and Generate
B.Reason and Act
C.Refine and Aggregate
D.Generate and Evaluate
AnswerB

ReAct interleaves reasoning traces with actions (tool use) to solve tasks.

Why this answer

ReAct stands for Reason + Act. The model first reasons about the question, then decides on an action (e.g., a tool call) to gather information, iterating until a final answer is reached.

24
MCQmedium

A prompt engineer is iteratively refining a prompt for a product review summarizer. They want to test which prompt version yields the most accurate summaries. Which approach should they use?

A.Increase temperature to get varied outputs and choose the most common one
B.Use a different model for each prompt version
C.Run both prompts on a single example and pick the better-looking output
D.Conduct an A/B test with a diverse set of inputs and compare outputs against established evaluation criteria
AnswerD

A/B testing with diverse inputs and clear criteria yields robust results.

Why this answer

A/B testing involves running both prompt variants on the same inputs and comparing outputs against human-annotated ground truth. This provides quantitative evidence of which prompt performs better.

25
MCQeasy

A prompt engineer wants the model to adopt a formal and authoritative tone when generating financial reports. Which approach is MOST effective?

A.Set the temperature to 0 to ensure deterministic output
B.Set the system prompt to 'You are a financial expert. Always respond with a formal, authoritative tone.'
C.Use few-shot examples of formal responses in the user message
D.Include the instruction 'Be formal' in the user message
AnswerB

The system prompt is designed to set the overall behavior, persona, and tone for the entire conversation.

Why this answer

Setting a system prompt (or preamble) instructs the model on its role, tone, and constraints before the user message. This is the standard way to enforce persona and tone consistently.

26
MCQhard

A data scientist is using self-consistency decoding to improve the accuracy of a reasoning task. Which of the following best describes the process?

A.Generate one chain-of-thought reasoning path and use it as the final answer
B.Generate multiple independent reasoning paths and aggregate the final answers by majority voting
C.Use a single forward pass with a low temperature setting
D.Branch into multiple reasoning trees and prune less promising branches
AnswerB

Correct: self-consistency uses multiple paths and voting.

Why this answer

Self-consistency generates multiple reasoning paths (e.g., with higher temperature) and selects the most consistent answer by majority vote, improving reliability.

27
MCQmedium

A developer is tuning parameters for a text-generation model and wants to reduce the likelihood of the same phrase appearing repeatedly. Which parameter should be adjusted?

A.Top-k
B.Frequency penalty
C.Stop sequences
D.Presence penalty
AnswerB

Correct: frequency penalty directly reduces repetition of the same tokens.

Why this answer

Frequency penalty reduces the model's tendency to repeat tokens or phrases by penalizing tokens that have already appeared in the generated text.

28
MCQmedium

A prompt engineer wants to generate a poem in a specific rhyming scheme (ABAB). Which combination of prompt components is LEAST likely to succeed?

A.Only task instruction: 'Write a poem'
B.Task instruction: 'Write a poem' and output format specification: 'Use ABAB rhyme scheme'
C.Task instruction: 'Write a poem in ABAB rhyme scheme' and an example stanza
D.Task instruction: 'Write a poem' with a few-shot example of an ABAB poem
AnswerA

Without specifying the rhyme scheme or providing examples, the model will likely default to free verse or a common pattern, not ABAB.

Why this answer

Providing only a task instruction ('Write a poem') without specifying the rhyme scheme or giving examples leaves the model to choose its own structure. The other options give explicit formatting or examples.

29
MCQmedium

A team is building a code generation assistant that should output Python code without any explanations. They want to ensure the model only returns the code block. Which prompt strategy is MOST effective?

A.Set the system prompt to 'You are a code generator. Output only Python code. Do not include any explanations.' and the user message to 'Generate code for...'
B.Use chain-of-thought prompting to reason about the code before writing it
C.Use a zero-shot prompt: 'Write Python code for the following task:'
D.Set max tokens to a low value to limit output length
AnswerA

This combination precisely constrains the output to only code.

Why this answer

Option A is correct because setting the system prompt to explicitly instruct the model to output only Python code without explanations directly enforces the desired behavior at the highest priority level of the prompt hierarchy. This approach leverages the system prompt's role as a persistent instruction that overrides user messages, ensuring the model strictly returns code blocks without extraneous text.

Exam trap

Cisco often tests the misconception that limiting output length (max tokens) or using zero-shot prompts is sufficient to control output format, when in fact only explicit system-level instructions reliably enforce content restrictions like 'code only'.

How to eliminate wrong answers

Option B is wrong because chain-of-thought prompting encourages the model to output intermediate reasoning steps, which would produce explanations alongside the code, contradicting the requirement for code-only output. Option C is wrong because a zero-shot prompt like 'Write Python code for the following task:' does not explicitly prohibit explanations, leaving the model free to include comments or descriptive text, which fails the strict code-only constraint. Option D is wrong because setting max tokens to a low value may truncate the code output, potentially breaking syntax or omitting critical logic, and does not prevent the model from including explanations within the token limit.

30
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.Fine-tune a base LLM on the policy documents monthly
C.Use a larger foundation model with a longer context window and paste all documents into each prompt
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

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.

31
MCQeasy

Which parameter controls the randomness of the model's output by adjusting the probability distribution of the next token?

A.Frequency penalty
B.Top-p
C.Temperature
D.Max tokens
AnswerC

Temperature scales the logits to control the randomness of token selection.

Why this answer

Temperature adjusts the logits before softmax, making lower values (e.g., 0.1) more deterministic and higher values (e.g., 0.9) more random.

32
MCQhard

A prompt engineer is developing a multi-step reasoning application using the ReAct pattern. The model sometimes outputs incomplete reasoning or forgets to perform an action. Which improvement to the prompt is MOST likely to address this issue?

A.Add a system message that says 'You are a reasoning agent'
B.Use a zero-shot prompt with the instruction 'Reason step by step and then act'
C.Include a template pattern in the system prompt that explicitly defines the format for each step
D.Increase the temperature to 0.8 to allow more creative reasoning
AnswerC

A template pattern provides a clear structure for the model to follow, reducing omissions.

Why this answer

Providing a clear template that structures the reasoning and action steps (e.g., 'Thought: ... Action: ... Observation: ...') helps the model follow the ReAct pattern consistently.

Role prompting alone does not enforce the step-by-step structure.

33
MCQmedium

A prompt engineer wants to reduce the model's tendency to generate overly creative or off-topic responses when summarizing financial reports. Which parameter adjustment is MOST appropriate?

A.Increase top-k to 100
B.Decrease temperature to 0.2
C.Decrease frequency penalty to 0
D.Increase temperature to 1.0
AnswerB

Lower temperature makes outputs more focused and less random.

Why this answer

Lowering temperature (e.g., to 0.2) makes the model more deterministic and focused, reducing creativity and off-topic responses.

34
Multi-Selecthard

A prompt engineer is iteratively refining a prompt for a summarization task. Which THREE practices should she adopt to improve prompt performance systematically?

Select 3 answers
A.Test prompt with a diverse set of input documents
B.A/B test different prompt variants on a held-out set
C.Always use the same input to ensure consistency
D.Increase max tokens to the maximum allowed
E.Establish clear evaluation criteria (e.g., accuracy, conciseness)
AnswersA, B, E

Diverse testing reveals edge cases and overfitting.

Why this answer

Testing with diverse inputs, establishing evaluation criteria, and A/B testing prompt variants are core to iterative refinement.

35
MCQmedium

A prompt engineer notices that the model's output frequently repeats the same phrases. Which parameter adjustment is MOST likely to reduce this repetition?

A.Increase max tokens
B.Decrease top-p to 0.5
C.Increase the frequency penalty
D.Increase temperature to 0.9
AnswerC

Frequency penalty penalizes tokens based on how often they have appeared, reducing repetition.

Why this answer

Frequency penalty reduces the chance of repeating tokens that have already appeared, directly mitigating repetition. Presence penalty also helps but is broader; frequency penalty is more targeted.

36
Multi-Selecteasy

A prompt engineer wants to use chain-of-thought prompting to improve arithmetic reasoning. Which TWO steps are essential for implementing this technique?

Select 2 answers
A.Provide a few-shot example that includes step-by-step reasoning
B.Add a stop sequence after the final answer
C.Use a large max_tokens value to allow long output
D.Set temperature to 0.0 for deterministic reasoning
E.Instruct the model to think step by step before answering
AnswersA, E

Few-shot examples with reasoning demonstrate the pattern.

Why this answer

Chain-of-thought requires the model to output intermediate reasoning steps, and providing an example with reasoning helps guide the model.

37
MCQhard

A developer is using the Cohere Command model via OCI Generative AI and wants to ground responses in a specific uploaded document. Which syntax should be used in the preamble to enable document-grounded generation?

A.Set a system message with 'DOCUMENT: ...'
B.Include the document in the user message with 'Document: ...'
C.Pass the document as a separate parameter named 'context'
D.Use the preamble field with '<doc>document text</doc>'
AnswerD

Cohere's API expects the document to be embedded in the preamble using <doc> tags for grounded generation.

Why this answer

Cohere's document-grounded generation uses a special preamble format that includes document references. The correct syntax is to enclose document text in <doc> tags within the preamble.

38
MCQhard

A prompt engineer is designing a system that generates SQL queries from natural language. The model sometimes produces unsafe queries (e.g., DROP TABLE). Which constraint in the system prompt would BEST mitigate this risk?

A.Use a few-shot prompt with only safe SELECT examples
B.Use role prompting: 'You are an expert SQL developer'
C.Set frequency penalty to 1.0 to avoid repetitive unsafe patterns
D.Include a constraint: 'You may only generate SELECT statements. Do not generate DDL or DML statements like DROP, DELETE, INSERT, or UPDATE.'
AnswerD

This explicit constraint directly addresses the safety concern.

Why this answer

Option D is correct because it explicitly prohibits the model from generating DDL (Data Definition Language) and DML (Data Manipulation Language) statements, directly addressing the risk of unsafe queries like DROP TABLE. By constraining the output to only SELECT statements, the prompt enforces a strict policy that prevents the model from producing destructive or modifying SQL commands, which is the most effective mitigation among the options.

Exam trap

Cisco often tests the misconception that implicit guidance (like few-shot examples or role prompting) is sufficient to enforce safety, when in fact only explicit, unambiguous constraints can reliably prevent the model from generating prohibited outputs.

How to eliminate wrong answers

Option A is wrong because a few-shot prompt with only safe SELECT examples does not explicitly forbid unsafe queries; the model may still generalize from its training data and generate DROP or DELETE statements when faced with ambiguous or malicious input. Option B is wrong because role prompting ('You are an expert SQL developer') does not impose any behavioral constraint; an expert developer might still generate DDL or DML statements if the user asks for them, as the role does not inherently restrict output. Option C is wrong because setting a frequency penalty to 1.0 reduces the likelihood of repetitive patterns but does not prevent the model from generating unsafe queries; it only discourages token repetition, not the generation of specific dangerous commands.

39
MCQeasy

In prompt engineering, what is the role of a system prompt?

A.To handle error messages from the API
B.To specify the user's current query
C.To provide examples of desired outputs
D.To define the model's persona, tone, and behavioral constraints
AnswerD

System prompt is designed for high-level instructions like persona and rules.

Why this answer

The system prompt in prompt engineering defines the model's persona, tone, and behavioral constraints, setting the overarching context for all interactions. This is distinct from user prompts, which carry the current query. By establishing these parameters, the system prompt guides the model's responses consistently across a session, ensuring alignment with desired output characteristics.

Exam trap

Cisco often tests the distinction between system prompts and user prompts, where candidates mistakenly think the system prompt handles the user's current query or provides examples, rather than defining the model's persona and constraints.

How to eliminate wrong answers

Option A is wrong because handling error messages from the API is a function of client-side error handling code, not the system prompt; the system prompt does not interact with API error responses. Option B is wrong because specifying the user's current query is the role of the user prompt, not the system prompt; the system prompt sets the context, not the immediate request. Option C is wrong because providing examples of desired outputs is the function of few-shot prompts or user prompts with examples, not the system prompt; the system prompt defines behavioral constraints, not sample outputs.

40
Multi-Selecthard

A prompt engineer is using the ReAct pattern to enable the model to reason and act (e.g., call tools). Which THREE components are essential in the prompt to implement ReAct correctly?

Select 3 answers
A.A stop sequence after each action
B.A system prompt that sets a high temperature
C.A list of available actions or tools with descriptions
D.A scratchpad where the model can write intermediate thoughts
E.A few-shot example showing the Thought/Action/Observation loop
AnswersC, D, E

The model must know which actions it can take.

Why this answer

ReAct requires a scratchpad to record reasoning, a set of available actions (tools), and a format showing how to interleave reasoning and actions.

41
Multi-Selectmedium

A prompt engineer is testing a new prompt for a Q&A system. The prompt includes ambiguous wording that causes the model to answer inconsistently. Which TWO steps should the engineer take to resolve this? (Choose two.)

Select 2 answers
A.Use A/B testing between the original and rewritten prompt to measure improvement
B.Increase the temperature to encourage diverse responses
C.Test the prompt with a diverse set of inputs to identify remaining ambiguities
D.Reduce the max tokens to force shorter answers
E.Rewrite the prompt to remove ambiguous terms and provide clear context
AnswersC, E

Testing with varied inputs helps reveal where the prompt is still unclear.

Why this answer

Clarifying the prompt removes ambiguity. Testing with diverse inputs helps uncover edge cases. A/B testing would compare variants but does not directly fix ambiguity.

Temperature reduction does not clarify instructions.

42
MCQmedium

A developer is using Cohere Command R in OCI to build a question-answering system over a large set of documents. They want the model to generate answers grounded in the provided documents. Which syntax should they use in the prompt to properly ground the model's responses?

A.Utilize Cohere's document-grounded generation syntax, such as inserting 'document:' markers before each document
B.Use the OCI Generative AI service's 'chat' API with a 'knowledgeBase' parameter
C.Embed the documents in the system message and ask the model to use them
D.Set the 'grounding' parameter to 'true' in the API call
AnswerA

Cohere's syntax explicitly tells the model to treat the marked text as reference documents for grounding.

Why this answer

Option A is correct because Cohere Command R supports a specific document-grounded generation syntax where each document is prefixed with 'document:' markers. This tells the model to base its answers strictly on the provided documents, reducing hallucination and ensuring grounded responses. The syntax is part of Cohere's native prompt engineering guidelines for RAG (Retrieval-Augmented Generation) workflows.

Exam trap

Cisco often tests the misconception that grounding can be achieved via a simple API parameter or generic context embedding, when in fact Cohere requires explicit 'document:' markers in the prompt to enforce grounded generation.

How to eliminate wrong answers

Option B is wrong because the OCI Generative AI service's 'chat' API with a 'knowledgeBase' parameter is not a Cohere-specific feature; it is an OCI abstraction that may not leverage Cohere's native document-grounded generation syntax. Option C is wrong because simply embedding documents in the system message without the 'document:' markers does not properly instruct Cohere Command R to ground its responses; the model may treat the documents as general context rather than authoritative sources. Option D is wrong because there is no 'grounding' parameter in the Cohere Command R API; grounding is achieved through prompt structure, not a boolean flag.

43
Multi-Selectmedium

An organization maintains a library of prompt templates for various use cases. Which three practices are essential for effective prompt management? (Choose three.)

Select 3 answers
A.Adjust temperature and top-p for each prompt variant
B.Store prompt templates in a shared, accessible repository
C.Define evaluation criteria to measure prompt performance
D.Conduct A/B testing on every prompt change
E.Version each prompt template and track changes
AnswersB, C, E

Central storage promotes reuse and consistency.

Why this answer

Versioning, storing templates in a central library, and establishing evaluation criteria are key to managing prompts. A/B testing is good but not a management practice; parameter tuning is separate.

44
MCQhard

A prompt engineer is designing a ReAct pattern prompt to enable an LLM to use external tools. Which of the following is a key characteristic of the ReAct pattern?

A.The model uses a single tool call to answer the question
B.The model produces a chain of thought followed by an action, then observes the result and continues reasoning
C.The model generates a final answer without any intermediate steps
D.The model is fine-tuned specifically for tool use
AnswerB

Correct: ReAct alternates between reasoning, action, and observation.

Why this answer

ReAct interleaves reasoning steps (e.g., 'I need to find the current weather') with actions (e.g., 'Action: call weather API') and observations, allowing the model to reason and act in a cycle.

45
MCQhard

An LLM application generates product descriptions. The output is sometimes repetitive (e.g., 'innovative' appears multiple times). Which parameter adjustment is MOST likely to reduce this repetition without harming creativity?

A.Increase temperature from 0.7 to 1.0
B.Set frequency penalty to a positive value, e.g., 0.3
C.Decrease max tokens from 200 to 100
D.Increase top-k from 40 to 80
AnswerB

Frequency penalty directly penalizes tokens that have already been used, reducing repetition.

Why this answer

The frequency penalty reduces the likelihood of repeating tokens that have already appeared. A moderate penalty (e.g., 0.3) discourages repetition while allowing creative word choices. Temperature and top-k affect randomness, not repetition.

46
Multi-Selecthard

A team is building a legal document summarization system using OCI Generative AI. They need to ensure high accuracy and adherence to strict output formatting. Which THREE practices should they adopt? (Choose three.)

Select 3 answers
A.Disable stop sequences to allow complete summaries
B.Define a system prompt specifying the role of a legal expert and constraints
C.Include an output format specification for the summary structure
D.Set the temperature to 0.9 to encourage creative variations
E.Use few-shot examples of correct summaries in the prompt
AnswersB, C, E

System prompts set the overall context and behavior, improving consistency.

Why this answer

Option B is correct because defining a system prompt that specifies the role of a legal expert and constraints guides the OCI Generative AI model to adopt a precise, authoritative tone and adhere to domain-specific rules. This is a core prompt engineering technique that sets the context and boundaries for the model's behavior, directly improving accuracy and compliance with legal standards.

Exam trap

Cisco often tests the misconception that higher temperature improves output quality, but for accuracy-critical tasks like legal summarization, low temperature and structured prompts are essential to avoid hallucination and format drift.

47
MCQmedium

A data scientist is designing a prompt to generate a structured report with sections for Summary, Findings, and Recommendations. Which output format specification in the prompt would be MOST effective?

A."Write a report with three sections: Summary, Findings, Recommendations."
B."Provide the output in JSON format with keys: 'summary', 'findings', and 'recommendations'."
C."Return the report in bullet points."
D."Output the report as a markdown document with headings."
AnswerB

Explicit JSON key specification yields a structured, easily parsed output.

Why this answer

Specifying JSON output with clear keys ensures the model returns a structured, machine-parseable result. Natural language descriptions are ambiguous, and markdown may not be reliably parsed.

48
MCQeasy

What is the PRIMARY purpose of the 'stop sequences' parameter in text generation?

A.To prevent the model from generating offensive content
B.To specify tokens that the model should avoid using
C.To encourage the model to include specific phrases in the output
D.To define sequences that, when generated, cause the model to cease generation
AnswerD

Stop sequences like ' ' or '###' halt generation at that point.

Why this answer

Stop sequences tell the model when to stop generating further tokens, allowing control over output length or termination upon specific strings.

49
Multi-Selecthard

A team is troubleshooting a chatbot that sometimes outputs harmful content despite having a system prompt with safety instructions. Which THREE measures should they implement to reduce the risk?

Select 3 answers
A.Reinforce the system prompt with explicit safety constraints and periodic reminders
B.Increase temperature to make output more random
C.Add more few-shot examples of safe responses
D.Use output filtering to scan and block harmful responses before showing to users
E.Implement input filtering to detect and block malicious prompt injection attempts
AnswersA, D, E

Strengthening the system prompt with detailed safety rules reduces the chance of harmful outputs.

Why this answer

Input filtering blocks malicious inputs, output filtering catches harmful responses before delivery, and system prompt reinforcement strengthens initial instructions. Adding more few-shot examples does not directly address safety.

50
MCQhard

A developer notices that a Cohere Command model occasionally generates contradictory statements in the same response when asked to reason step-by-step. Which technique is designed to address inconsistency by generating multiple reasoning paths and selecting the most consistent answer?

A.Few-shot prompting
B.Temperature tuning
C.Tree-of-thought prompting
D.Self-consistency
AnswerD

Self-consistency performs multiple reasoning chains, then votes on the most consistent answer, reducing contradictions.

Why this answer

Self-consistency is a technique specifically designed to address inconsistency in model outputs by sampling multiple reasoning paths (e.g., via chain-of-thought) and then selecting the most consistent answer through majority voting or similar aggregation. This directly targets the problem of contradictory statements within a single response by leveraging the model's own diverse reasoning trajectories to converge on a reliable answer.

Exam trap

Cisco often tests the distinction between techniques that explore multiple paths (tree-of-thought) versus those that aggregate across them (self-consistency), so candidates may confuse tree-of-thought's branching evaluation with self-consistency's voting mechanism.

How to eliminate wrong answers

Option A is wrong because few-shot prompting provides examples to guide the model's output format or style but does not generate multiple reasoning paths or resolve internal contradictions. Option B is wrong because temperature tuning controls the randomness of token sampling (e.g., lower values for deterministic outputs) but does not explicitly generate or compare multiple reasoning paths for consistency. Option C is wrong because tree-of-thought prompting explores multiple reasoning branches and evaluates them, but it does not inherently select the most consistent answer via aggregation; self-consistency is the specific technique that uses voting across multiple paths.

51
MCQhard

An AI application uses chain-of-thought prompting to solve math problems. The team observes that the model sometimes arrives at correct answers but with flawed reasoning. Which technique can specifically help by aggregating multiple reasoning paths?

A.Role prompting
B.Self-consistency prompting
C.Tree-of-thought prompting
D.Few-shot prompting
AnswerB

Self-consistency samples multiple chain-of-thought outputs and chooses the most consistent answer, effectively filtering flawed reasoning.

Why this answer

Self-consistency generates several reasoning chains and selects the most common answer, improving robustness even if some chains have flawed steps.

52
MCQeasy

Which of the following is an example of a prompt template?

A."Write a product description for {product_name} targeting {audience}."
B."You are a helpful assistant."
C."Translate the following English text to French: 'Hello'"
D."Explain the concept of gravity."
AnswerA

Placeholders make it a template.

Why this answer

A template uses placeholders like {product_name} that are filled at runtime, making prompts reusable and dynamic.

53
Multi-Selectmedium

A company is building a code generation assistant. They want the model to output only valid JSON and to avoid any natural language explanations. Which TWO settings should be applied?

Select 2 answers
A.Set max_tokens to a low value to force brevity
B.Add a system prompt: "You are a JSON-only code generator. Output only JSON, no explanation."
C.Set temperature to 0.5 for balanced creativity
D.In the user message, specify: "Return only the JSON object without any additional text."
E.Use a stop sequence like '\n' to prevent extra lines
AnswersB, D

Clear instruction in system prompt sets the expected format.

Why this answer

Instructing the model to output JSON and setting a stop sequence to prevent extra text ensures the desired output format.

54
MCQeasy

A developer wants the model to generate a bullet list of steps to troubleshoot a network issue. Which output format specification should be included in the prompt?

A.Use a few-shot example with numbered steps
B.Provide a table format
C.Set temperature to 0
D.Request 'bullet list' in the output format
AnswerD

Specifying 'bullet list' in the output format prompts the model to generate each step as a bullet point.

Why this answer

Explicitly requesting a bullet list in the output format specification is the most direct way to achieve the desired structure.

55
MCQeasy

What is the primary goal of chain-of-thought prompting?

A.Prevent the model from hallucinating
B.Make the output more creative
C.Reduce output token count
D.Encourage step-by-step reasoning to improve accuracy on multi-step problems
AnswerD

Correct: it breaks down reasoning into intermediate steps.

Why this answer

Chain-of-thought encourages the model to perform step-by-step reasoning before arriving at an answer, improving performance on complex tasks.

56
Multi-Selecthard

A developer is using tree-of-thought prompting to solve a complex planning problem. Which THREE characteristics are typical of tree-of-thought?

Select 3 answers
A.It explores multiple reasoning branches in parallel
B.It generates a single linear chain of reasoning
C.It allows backtracking to explore alternative branches
D.It always returns a single final answer via majority vote
E.It uses evaluation or heuristics to prune unpromising branches
AnswersA, C, E

Correct: branches represent different reasoning paths.

Why this answer

Tree-of-thought explores multiple reasoning branches in parallel, uses evaluation or heuristics to prune unpromising branches, and can backtrack to explore alternatives. It does not follow a single linear path or guarantee a single answer without voting.

57
MCQeasy

What is the primary purpose of setting the 'top-k' parameter in an LLM?

A.To truncate the output after k tokens
B.To control the creativity of the output by scaling logits
C.To penalize tokens that have already appeared in the generated text
D.To limit the next token selection to the k most probable tokens
AnswerD

Top-k sampling selects only from the top k tokens by probability, ignoring the long tail of low-probability tokens.

Why this answer

Top-k restricts the model to sample only from the k most likely next tokens, reducing the chance of unusual or off-topic words. Top-p is nucleus sampling; temperature controls randomness; frequency penalty reduces repetition.

58
MCQeasy

What is the primary purpose of setting a low temperature (e.g., 0.1) when generating text with an LLM?

A.Make responses more deterministic and focused
B.Increase creativity and diversity of responses
C.Enable the model to use external tools
D.Reduce the maximum number of tokens generated
AnswerA

Correct: low temperature concentrates probability on high-likelihood tokens.

Why this answer

Temperature controls randomness; low values make the model deterministic and focused on the most likely tokens, which is ideal for factual tasks.

59
MCQeasy

What is the main advantage of using chain-of-thought (CoT) prompting over standard few-shot prompting for complex reasoning tasks?

A.CoT reduces the number of tokens needed in the prompt
B.CoT allows the model to use any tools available in the environment
C.CoT improves performance on multi-step reasoning tasks by generating step-by-step explanations
D.CoT eliminates the need for any examples in the prompt
AnswerC

CoT explicitly models the reasoning chain, helping the model reach correct conclusions.

Why this answer

CoT encourages the model to articulate intermediate reasoning steps, which improves accuracy on tasks that require multi-step logic. Few-shot provides examples but not the reasoning process.

60
Multi-Selectmedium

Which THREE are common prompt failures that can degrade model performance?

Select 3 answers
A.Using too few tokens in the output
B.Prompt injection vulnerabilities that allow malicious input to override instructions
C.Ambiguous instructions that can be interpreted in multiple ways
D.Insufficient context for the model to answer correctly
E.Setting temperature too high
AnswersB, C, D

Prompt injection can hijack the model's behavior.

Why this answer

Ambiguous instructions, insufficient context, and prompt injection are well-known failure modes.

61
MCQeasy

A prompt engineer wants to generate a JSON object from an LLM response. Which prompt component is MOST critical to ensure the output is valid JSON?

A.Context and background
B.Task instruction
C.Examples (few-shot)
D.Output format specification
AnswerD

Explicitly stating 'Output as JSON' with the desired structure is the most direct way to get valid JSON.

Why this answer

Explicitly specifying the output format (e.g., 'Provide the answer as a JSON object with keys ...') is essential for structured output. The other components are important for other aspects but not for format compliance.

62
Multi-Selectmedium

A prompt engineer is designing a prompt for legal document analysis. The model should output JSON with a specific structure. Which TWO practices are essential to include in the prompt?

Select 2 answers
A.Define the JSON schema in the system prompt
B.Provide a concrete example of the desired JSON output
C.Use a stop sequence of "}"
D.Increase max tokens to 5000
E.Set temperature to 1.0 for creativity
AnswersA, B

Defining the schema sets the expected structure.

Why this answer

Option A is correct because defining the JSON schema in the system prompt explicitly instructs the model on the exact structure and data types required for the output. This is a foundational practice in prompt engineering for structured data generation, as it reduces ambiguity and ensures the model adheres to a predefined format, which is critical for downstream parsing in legal document analysis.

Exam trap

The trap here is that candidates confuse 'stop sequences' (used to truncate output) with 'format constraints' (like JSON schemas), or assume higher token limits and creative temperature settings are universally beneficial, when in fact they degrade reliability for structured data tasks.

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

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 based on the latest policy documents without retraining the model. By indexing the documents in a vector store and retrieving relevant chunks at query time, RAG provides up-to-date answers while keeping the underlying LLM static, which directly addresses the requirement of monthly updates without retraining.

Exam trap

Cisco often tests the misconception that fine-tuning is the only way to adapt an LLM to new data, when in fact RAG provides a cost-effective, retraining-free alternative for dynamic knowledge bases.

How to eliminate wrong answers

Option A is wrong because training a custom model from scratch each month is computationally expensive, time-consuming, and contradicts the requirement to avoid retraining. Option C is wrong because pasting all policy documents into each prompt would exceed typical context window limits (e.g., 4K–128K tokens for most models), leading to truncation, high costs, and degraded performance due to irrelevant context. Option D is wrong because fine-tuning a base LLM monthly still requires retraining the model, which the team cannot afford, and fine-tuning may cause catastrophic forgetting or overfitting to the latest documents.

64
MCQhard

A developer is using the Cohere Command R model with a preamble set to "You are a helpful assistant." The user message contains a question. The model's response is factual but lacks detail. To encourage more comprehensive answers, which modification should be made?

A.Use a stop sequence like "\n" to force longer responses
B.Set the temperature to 0.0
C.Add "Provide a thorough and detailed response." to the preamble
D.Increase the max_tokens parameter to 1000
AnswerC

Preamble is the system message; instructing the model to be detailed influences its behavior.

Why this answer

Adding a directive in the preamble, such as "Provide thorough and detailed responses," sets the desired behavior from the start.

65
Multi-Selectmedium

A developer is using Cohere Command R with document-grounded generation. Which THREE elements must be included in the prompt to enable effective document grounding?

Select 3 answers
A.Preamble that instructs the model to use provided documents
B.A stop sequence to end generation
C.Conversation history in the expected format
D.Documents wrapped in the document-grounded generation syntax
E.A temperature of 0.0
AnswersA, C, D

Preamble is a system-level instruction for the task.

Why this answer

The preamble sets the task, conversation history maintains context, and the document syntax provides source material.

66
MCQmedium

A prompt engineer wants the LLM to adopt the persona of a 'friendly customer support agent' for all interactions. Which approach is most effective?

A.Include the persona instruction in every user message
B.Use a high temperature to encourage friendly language
C.Fine-tune the model on customer support dialogues
D.Set the persona in the system prompt (or preamble) before the conversation begins
AnswerD

The system prompt/preamble influences all subsequent messages.

Why this answer

Oracle's generative AI services support a system prompt (or preamble in Cohere) that sets the assistant's persona, which applies to the entire conversation.

67
Multi-Selectmedium

A company wants to use Cohere Command for a customer support chatbot that references a knowledge base. The chatbot must maintain conversational context across multiple turns. Which TWO Cohere-specific features should they use?

Select 2 answers
A.Document-grounded generation syntax
B.Preamble
C.Max tokens
D.High temperature setting
E.Conversation history format
AnswersB, E

Preamble defines the chatbot's behavior and role.

Why this answer

The preamble sets the chatbot's persona and rules. Conversation history format allows passing previous exchanges for context. Document-grounded generation is for knowledge base retrieval but not for multi-turn context.

68
MCQmedium

A prompt engineer is testing different versions of a prompt to improve accuracy on a classification task. Which practice is most appropriate for systematic refinement?

A.Always increase the number of few-shot examples
B.Run A/B tests on a representative evaluation set and measure accuracy
C.Manually review outputs of a few examples and adjust based on intuition
D.Change the model to a larger one
AnswerB

A/B testing with a labeled dataset provides quantitative evidence to guide refinement.

Why this answer

A/B testing with a holdout evaluation set allows objective comparison of prompt variants and measures performance improvements reliably.

69
MCQhard

A prompt engineer is designing a system that must extract structured data from unstructured text. The model occasionally outputs extra text beyond the required JSON. Which parameter should be adjusted to enforce strict output format?

A.Increase the frequency penalty
B.Reduce the temperature to 0
C.Increase the top-p value
D.Set a stop sequence to the closing delimiter of the JSON (e.g., '}')
AnswerD

Stop sequences halt generation when the specified token or string is produced, ensuring no additional output after the JSON.

Why this answer

Stop sequences tell the model when to stop generating. By adding a stop sequence like '}' (end of JSON), the model will terminate after the JSON object, preventing extra text.

70
MCQhard

A developer is using a Cohere Command model via OCI Generative AI. They want the model to generate responses strictly in JSON format for a specific task, but the model sometimes outputs additional explanatory text. Which prompt engineering technique is MOST effective?

A.Include a single example of a JSON output in the user message
B.Set the temperature to 0.0 to make the model deterministic
C.Use a stop sequence '}' to force the model to stop after the JSON
D.Add a preamble: 'You are a JSON generator. Output only valid JSON. Do not include any other text.'
AnswerD

The preamble acts as a system prompt, setting the role and strict output constraint. Combined with explicit instructions, this effectively suppresses extra text.

Why this answer

Using a system prompt to set the persona (e.g., 'You are a JSON generator') and including a step-by-step instruction reduces unwanted text. Cohere's preamble works like a system prompt to enforce constraints.

71
MCQmedium

In OCI Generative AI, when using the Cohere Command model, which parameter is used to discourage the model from repeating the same phrases?

A.presence_penalty
B.frequency_penalty
C.temperature
D.top-k
AnswerB

Frequency penalty applies a penalty proportional to token frequency, reducing repetition.

Why this answer

Frequency penalty reduces the likelihood of tokens that have already appeared, directly targeting repetition of phrases.

72
Multi-Selectmedium

A data scientist is designing a prompt for code generation and needs to reduce the likelihood of the model generating incorrect or hallucinated code. Which two parameter adjustments are most effective? (Choose two.)

Select 2 answers
A.Set top-k to a high value (e.g., 100)
B.Set frequency_penalty to a moderate value (e.g., 0.5)
C.Increase max_tokens significantly
D.Set presence_penalty to 0
E.Set temperature to a low value (e.g., 0.1)
AnswersB, E

Frequency penalty discourages repetition of tokens, which can reduce hallucinated patterns.

Why this answer

Lowering temperature reduces randomness, making outputs more deterministic and less prone to hallucinations. Frequency penalty reduces repetitive mistakes. Top-k and presence penalty are less directly effective.

73
MCQeasy

Which prompting technique involves providing the model with a small set of input-output examples within the prompt to guide its behavior?

A.Tree-of-thought prompting
B.Chain-of-thought prompting
C.Few-shot prompting
D.Zero-shot prompting
AnswerC

Correct: few-shot provides a few examples.

Why this answer

Few-shot prompting includes examples of desired input-output pairs, helping the model infer the task without fine-tuning.

74
MCQmedium

A developer creates a prompt for a code generation task but the output often contains syntax errors. Which adjustment to the prompt is MOST likely to improve correctness?

A.Remove the output format specification to give the model freedom
B.Add a few examples of correct code for similar tasks in the prompt
C.Increase the temperature to 0.9 for more creative solutions
D.Set the max tokens to a very high value
AnswerB

Few-shot examples set a clear pattern for the model to follow, improving syntax.

Why this answer

Adding few-shot examples of correct code directly in the prompt provides the model with explicit patterns to follow, reducing syntactic drift. This technique, known as few-shot prompting, anchors the model's output to the demonstrated structure and syntax, which is far more effective than relying on the model's internal knowledge alone for code generation tasks.

Exam trap

Cisco often tests the misconception that increasing creativity (temperature) or removing constraints improves output quality, when in fact structured examples are the most reliable method for enforcing correctness in code generation tasks.

How to eliminate wrong answers

Option A is wrong because removing the output format specification removes crucial constraints that help the model adhere to a consistent structure, increasing the likelihood of malformed output. Option C is wrong because increasing temperature to 0.9 introduces more randomness, which exacerbates syntax errors by encouraging less predictable token sequences. Option D is wrong because setting max tokens to a very high value does not address the root cause of syntax errors; it only allows the model to generate longer outputs, which may contain even more errors.

75
MCQmedium

A developer is using a prompt template that includes placeholders like {context} and {question}. They want to version these templates for A/B testing. Which practice is BEST for managing prompt templates?

A.Use a dedicated prompt library with versioning, such as a database table with version numbers
B.Save each template as a separate Python file in a Git repository
C.Store templates only in the application code as string constants
D.Use a spreadsheet to track template versions
AnswerA

A prompt library provides structured storage, version tracking, and easy retrieval for experiments.

Why this answer

Storing prompt templates in a centralized prompt library with version control enables systematic management, collaboration, and rollback. It also supports A/B testing different versions.

Page 1 of 2 · 120 questions totalNext →

Ready to test yourself?

Try a timed practice session using only Oci Genai Prompt Engineering questions.