Learn. Practice. Feel prepared.
Prompt Engineering Objective Questions and Answers
This prompt engineering quiz contains carefully curated objective questions with correct answers and clear explanations. It is designed for developers, AI practitioners, and interview preparation, covering modern prompting strategies, LLM behavior, optimization techniques, and safety practices.
Practice Prompt Engineering MCQs with Detailed Explanations
Answer at least 12 questions to submit and verify answers.
1 What is the primary goal of prompt engineering? Easy
Correct answer:
To design effective inputs for AI models
Prompt engineering focuses on crafting effective inputs to guide AI models toward desired outputs.
2 Which prompting technique provides examples in the input? Easy
Correct answer:
Few-shot prompting
Few-shot prompting includes sample examples to help the model understand the task better.
3 What does zero-shot prompting mean? Easy
Correct answer:
Providing no examples
Zero-shot prompting means asking the model to perform a task without providing examples.
4 Which technique encourages the model to explain its reasoning step-by-step? Medium
Correct answer:
Chain-of-thought prompting
Chain-of-thought prompting improves reasoning by asking the model to show intermediate steps.
5 What is prompt injection? Medium
Correct answer:
A method to attack AI systems via malicious prompts
Prompt injection is a security risk where malicious input manipulates model behavior.
6 Which of the following improves output consistency? Medium
Correct answer:
Providing structured instructions
Structured prompts with clear instructions lead to more consistent outputs.
7 What role does temperature play in LLM output? Medium
Correct answer:
Controls randomness
Temperature affects randomness; lower values produce deterministic outputs.
8 Which parameter limits the maximum response length? Easy
Correct answer:
Max tokens
Max tokens defines the maximum number of tokens in the response.
9 What is the purpose of system prompts? Medium
Correct answer:
To define behavior and tone
System prompts guide the model's overall behavior and response style.
10 Which approach helps reduce hallucinations? Medium
Correct answer:
Providing clear constraints and context
Clear context and constraints reduce incorrect or fabricated responses.
11 What is few-shot chain-of-thought prompting? High
Correct answer:
Providing examples with reasoning steps
It combines few-shot learning with reasoning steps to improve performance.
12 What does 'top-p' control? High
Correct answer:
Probability mass for sampling
Top-p sampling selects tokens within a cumulative probability threshold.
13 Which prompt is more effective? Medium
Correct answer:
Explain AI in 3 bullet points with examples
Specific prompts yield more structured and useful responses.
14 What is role prompting? Medium
Correct answer:
Assigning a role to the model
Role prompting sets a persona like 'You are a senior developer'.
15 Which is an example of role prompting? Medium
Correct answer:
You are a Java expert, explain JVM
Assigning a role improves contextual quality of responses.