Courseiva

CCNA Prompt Engineering Questions

30 of 105 questions · Page 2/2 · Prompt Engineering · Answers revealed

76
Multi-Selectmedium

Which TWO parameters directly control the randomness and diversity of generated tokens?

Select 2 answers
A.Temperature
B.Stop sequences
C.Frequency penalty
D.Top-p
E.Max tokens
AnswersA, D

Temperature scales logits to affect randomness.

Why this answer

Temperature and top-p (nucleus sampling) are the primary parameters that influence randomness and diversity.

77
MCQmedium

A developer is using Cohere Command to answer questions grounded in internal technical manuals. They want to ensure the model only answers based on the provided documents and does not use its pre-trained knowledge. Which Cohere-specific technique should be applied?

A.Fine-tune the model on the technical manuals
B.Set temperature to 0 in the generation parameters
C.Use the document-grounded generation syntax by providing documents in the chat history with explicit citation instructions
D.Use the preamble to instruct the model to answer only from the documents
AnswerC

Cohere supports document-grounded generation where you supply documents and specify they are the only source.

Why this answer

Cohere's document-grounded generation syntax allows you to supply search results or documents and instruct the model to answer solely from those documents, reducing hallucination.

78
MCQmedium

Which prompting technique involves generating multiple independent reasoning paths and then selecting the most common answer?

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

Self-consistency generates multiple reasoning chains and aggregates the results to increase robustness.

Why this answer

Self-consistency runs chain-of-thought multiple times and aggregates answers (e.g., by majority vote) to improve reliability. The other options are different techniques.

79
Multi-Selecthard

An OCI user is troubleshooting a prompt that sometimes produces outputs containing offensive language. The prompt uses a system prompt to set a professional tone. Which THREE steps should the user take to mitigate this issue? (Select three.)

Select 3 answers
A.Apply a frequency penalty to discourage repetition of offensive phrases
B.Increase temperature to 0.9 to dilute the offending outputs
C.Test the prompt with diverse inputs including adversarial examples
D.Add a constraint in the system prompt: 'Do not use offensive or inappropriate language.'
E.Remove the system prompt to avoid overriding model's safety training
AnswersA, C, D

Frequency penalty reduces token repetition, which can help if offensive language appears repeatedly.

Why this answer

Adding explicit constraints in the system prompt, setting frequency/presence penalties to reduce undesirable patterns, and testing with adversarial inputs are effective safeguards. Using high temperature or removing the system prompt would worsen the problem.

80
MCQeasy

What is the primary benefit of using a system prompt to set the persona and tone before the user message?

A.It reduces the token cost of each user message
B.It sets the overall behavior, tone, and constraints for the model throughout the conversation
C.It automatically grounds the model in the latest training data
D.It replaces the need for few-shot examples
AnswerB

System prompts define the model's role and rules for the entire session.

Why this answer

The system prompt establishes persistent behavioral guidelines that influence all subsequent interactions, ensuring consistency without repeating instructions in every user message.

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

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.

82
MCQeasy

Which parameter controls the randomness of the model's output by scaling the probability distribution before sampling?

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

Temperature adjusts the softmax distribution's sharpness, directly controlling randomness.

Why this answer

Temperature scales the logits before softmax, affecting creativity. Higher values increase randomness; lower values make output more deterministic.

83
MCQeasy

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

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

Few-shot prompting provides a few examples in the prompt to demonstrate the task.

Why this answer

Few-shot prompting includes several examples of the desired input-output mapping to help the model understand the task and output format.

84
MCQmedium

An application uses an LLM to summarize legal documents. The summaries sometimes include hallucinations (details not in the original text). Which prompt engineering technique is MOST effective at reducing hallucinations?

A.Increase the temperature to 0.9 to make the model more cautious
B.Use a few-shot prompt with examples of correct summaries
C.Include the full document text in the prompt and instruct the model to base its summary only on that text
D.Set the presence penalty to a high value
AnswerC

Grounding the model with the source text is the most direct way to reduce hallucination.

Why this answer

Providing the full document context within the prompt (e.g., using a template that includes the document text) grounds the model's response and reduces the chance it invents details. Few-shot examples can also help but are secondary to providing the source.

85
MCQmedium

An AI engineer is designing a prompt to generate a report summary. The prompt currently says: 'Summarize the following text.' The output is often too verbose. Which modification would best enforce a concise, bullet-list format?

A.Change the prompt to: 'Summarize the following text in a bullet list of at most 5 items. Each bullet must be under 10 words.'
B.Set temperature to 1.0 for more focused outputs
C.Increase the frequency penalty to 2.0
D.Add an example summary at the end of the prompt
AnswerA

This provides explicit format and length constraints.

Why this answer

Explicitly specifying the output format (bullet list, max 5 items) gives the model clear constraints, reducing verbosity.

86
MCQhard

During iterative refinement, a prompt engineer tests two prompt variants on the same 100 inputs and measures accuracy. Variant A yields 85% accuracy, Variant B yields 82%. However, Variant B's outputs are more concise and preferred by users. What should the engineer do NEXT?

A.Select Variant B because user preference outweighs the small accuracy difference
B.Select Variant A because accuracy is the primary metric
C.Run a larger A/B test with statistical significance check before deciding
D.Define clear evaluation criteria that balance accuracy and conciseness, then re-evaluate
AnswerD

Establishing weighted criteria ensures both dimensions are considered and the decision is objective.

Why this answer

Evaluation should be based on multiple criteria beyond accuracy, especially user preference. The engineer should establish a composite metric that includes both accuracy and conciseness.

87
MCQeasy

Which parameter controls the creativity and randomness of a model's output by adjusting the probability distribution before sampling the next token?

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

Temperature directly controls the randomness of token selection.

Why this answer

Temperature scales logits before softmax; higher values increase randomness.

88
Multi-Selectmedium

A company is building a chatbot that must maintain a professional tone and avoid discussing off-topic subjects. Which TWO prompt engineering approaches should they combine to enforce these requirements?

Select 2 answers
A.Use a few-shot prompt with examples of off-topic conversations to teach the model what to avoid
B.Use a system prompt that defines the chatbot's role (e.g., 'You are a professional customer support agent') and includes constraints (e.g., 'Do not discuss topics outside of product support.')
C.Include a template pattern in the system prompt that specifies the response format (e.g., 'Greeting, Answer, Closing')
D.Set frequency penalty to 2.0 to reduce repetition of any words
E.Set temperature to 1.0 to ensure creative responses
AnswersB, C

This directly sets the tone and limits the scope.

Why this answer

A system prompt with role and constraints sets the overall behavior, and a template pattern for responses provides a consistent structure. The other options are less suitable.

89
MCQmedium

A data scientist is using OCI Generative AI to generate synthetic data for training. They observe that the model's outputs lack diversity and often repeat the same phrases. Which combination of parameter adjustments would BEST increase output diversity?

A.Set frequency penalty to 0.0 and presence penalty to 0.0
B.Increase temperature to 0.9 and increase top-p to 0.9
C.Decrease temperature to 0.3 and increase top-p to 0.9
D.Increase temperature to 0.9 and decrease top-p to 0.5
AnswerB

Both higher temperature and higher top-p increase randomness and token variety, boosting diversity.

Why this answer

Increasing temperature and top-p both increase randomness and diversity. Temperature controls the randomness of token selection, while top-p (nucleus sampling) allows a broader set of probable tokens.

90
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

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.

91
MCQmedium

A practitioner is developing a legal document summarization system and needs to reduce hallucinations. Which prompting technique is most effective for improving factual accuracy by exploring multiple reasoning paths?

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

Self-consistency samples multiple chain-of-thought outputs and picks the most consistent answer, improving factual accuracy.

Why this answer

Self-consistency generates several reasoning chains and aggregates the results, increasing reliability and reducing hallucinations in tasks requiring factual accuracy.

92
Multi-Selecthard

A prompt engineer is troubleshooting a chatbot that consistently fails to follow instructions when the user includes adversarial input. Which two strategies can mitigate prompt injection attacks? (Choose two.)

Select 2 answers
A.Increase temperature to make model less predictable
B.Use instruction shielding: clearly separate system instructions from user input
C.Use a smaller model to reduce capability
D.Add more few-shot examples with safe outputs
E.Implement input validation and sanitization to remove adversarial patterns
AnswersB, E

Separating instructions from user input prevents the model from treating user input as instructions.

Why this answer

Instruction shielding (clear separation of instruction and input) and input validation/sanitization are effective defenses. Adding more examples or adjusting temperature do not address injection.

93
Multi-Selecteasy

Which TWO are benefits of using few-shot prompting compared to zero-shot prompting?

Select 2 answers
A.It always reduces the need for parameter tuning
B.It eliminates the need for a system prompt
C.It reduces the number of tokens in the output
D.It helps the model understand the desired pattern, especially for uncommon tasks
E.It can improve performance on tasks requiring specific output formats
AnswersD, E

Examples guide the model for tasks it may not have seen frequently.

Why this answer

Few-shot provides examples that improve format adherence and guide the model, especially for complex tasks.

94
Multi-Selectmedium

A prompt library manager wants to implement version control for prompt templates used across multiple applications. Which THREE practices should they adopt?

Select 3 answers
A.Automatically test prompts on a fixed set of inputs after each change
B.Store prompts only in the application's database without history
C.Use semantic versioning (e.g., v1.2.3) for prompt templates
D.Maintain a changelog documenting what changed and why
E.Store prompt templates in a version control system (e.g., Git)
AnswersC, D, E

Semantic versioning helps communicate the nature of changes.

Why this answer

Storing templates in a version control system, using semantic versioning, and maintaining a changelog are standard practices for prompt version management. Automated testing is good but not version control per se.

95
MCQeasy

A developer wants the LLM to solve a math problem by reasoning step by step. Which prompting technique should they use?

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

Chain-of-thought prompts the model to reason step by step, which is ideal for math problems.

Why this answer

Chain-of-thought prompting explicitly instructs the model to show its reasoning steps, improving accuracy on multi-step problems.

96
MCQmedium

When tuning the temperature parameter for a text generation task, which effect does setting temperature to 0.1 have compared to 0.9?

A.It increases the maximum number of tokens generated
B.It reduces the vocabulary considered at each step
C.It makes outputs more focused and deterministic
D.It increases randomness, producing more diverse outputs
AnswerC

Low temperature reduces randomness, making outputs more deterministic.

Why this answer

Low temperature makes output more deterministic and repetitive; high temperature increases randomness and creativity.

97
MCQmedium

An organization wants to ensure that prompts submitted to an LLM do not contain sensitive customer data. Which practice is most effective?

A.Use a low temperature to avoid generating sensitive data
B.Increase the max tokens to allow the model to ignore sensitive data
C.Implement a prompt injection detection system that blocks malicious prompts
D.Sanitize user inputs by removing sensitive information before including them in the prompt
AnswerD

Correct: input sanitization is a direct mitigation.

Why this answer

Sanitizing prompts before submission (e.g., removing PII, using placeholders) prevents sensitive data from being sent to the model. Other options either do not prevent data leakage or are less direct.

98
Multi-Selectmedium

Which TWO are best practices for prompt management in production environments?

Select 2 answers
A.Avoid using system prompts to keep prompts simple
B.Maintain a prompt library with reusable templates
C.Store prompts in a version-controlled repository
D.Keep all prompts as hard-coded strings in the application code
E.Use the same prompt for all use cases to reduce complexity
AnswersB, C

A library encourages consistency and saves time.

Why this answer

Versioning and maintaining a library of templates are essential for tracking changes and reusability.

99
MCQhard

During iterative prompt refinement, a team evaluates two prompt variants on 100 test queries. Variant A scores 85% accuracy but occasionally generates offensive content. Variant B scores 80% accuracy with no safety issues. Which evaluation criterion should take priority for a customer-facing application?

A.Accuracy — because it is highest and the offensive content can be filtered post-hoc
B.Cost — the variant with higher accuracy uses fewer tokens
C.Safety — offensive content is unacceptable in a customer-facing system
D.Latency — because the variant with higher accuracy also has lower latency
AnswerC

Safety is a hard requirement; accuracy can be improved through further refinement.

Why this answer

For customer-facing applications, safety is paramount. Even if accuracy is slightly lower, ensuring no offensive content is critical to avoid reputational and legal risks. The team should prioritize safety and then work to improve accuracy.

100
MCQhard

A prompt engineer notices that the model sometimes generates outputs that include parts of the system prompt or user message verbatim. This is likely a symptom of which common prompt failure?

A.Ambiguous instructions
B.Conflicting requirements
C.Insufficient context
D.Prompt injection vulnerabilities
AnswerD

Prompt injection can cause the model to treat parts of the prompt as instructions and output them, leading to leakage.

Why this answer

Prompt injection vulnerabilities can cause the model to leak or repeat the prompt itself. This is a known failure mode where the model confuses the input with output.

101
MCQeasy

In few-shot prompting, what is the primary purpose of including examples in the prompt?

A.To reduce the need for a system prompt
B.To provide a template for the desired output format and reasoning pattern
C.To increase the model's vocabulary
D.To decrease the computational cost of inference
AnswerB

Examples demonstrate the expected mapping from input to output, reducing ambiguity.

Why this answer

Examples guide the model on the desired input-output pattern, improving task performance without fine-tuning.

102
MCQmedium

A prompt engineer is testing two versions of a prompt for a content generation task. They want to measure which version produces more factual and concise outputs. Which evaluation approach is BEST?

A.Use only the first output from each prompt and manually compare
B.Run A/B tests on a diverse set of inputs and score outputs based on predefined criteria
C.Ask the model to self-evaluate its outputs
D.Increase the temperature to see which prompt handles randomness better
AnswerB

A/B testing with multiple inputs and scoring criteria provides objective comparison.

Why this answer

A/B testing with clear metrics (factuality, conciseness) is the standard method for comparing prompt variants. Manual inspection on a few cases is not statistically robust; other options are not comparative.

103
MCQmedium

A user repeatedly gets the same phrase output by the model. Which parameter adjustment is MOST likely to reduce such repetitive patterns?

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

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

Why this answer

Frequency penalty reduces the likelihood of repeating tokens that have already appeared, directly combating repetition.

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

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.

105
MCQhard

An OCI Generative AI user notices that a model generates repetitive phrases when summarizing technical articles. Which parameter adjustment is MOST likely to reduce this repetition?

A.Decrease max tokens
B.Increase the frequency penalty
C.Set top-p to 0.95
D.Increase temperature to 0.9
AnswerB

Frequency penalty penalizes tokens that have already appeared, discouraging the model from repeating phrases.

Why this answer

Frequency penalty reduces the likelihood of repeating tokens that have already appeared, directly targeting repetition. Presence penalty also helps but frequency penalty is stronger for repeated phrases.

← PreviousPage 2 of 2 · 105 questions total

Ready to test yourself?

Try a timed practice session using only Prompt Engineering questions.