Learn vocabulary for structuring prompts: role prompting, context setting, output format specification, system vs user messages, and constraints.
0 / 25 completed
1 / 25
What is 'role prompting' in the context of language model prompts?
Role prompting means instructing the model to adopt a specific persona or area of expertise — for example, 'Act as a senior DevOps engineer with experience in Kubernetes.' This frames the tone and knowledge level of the response.
2 / 25
What is a 'system message' in a prompt, versus a 'user message'?
In most LLM APIs, the system message is a special role used to configure the model's behaviour across the conversation — defining persona, constraints, and output style. The user message is the actual request each turn.
3 / 25
What does 'output format specification' mean in prompt engineering?
Output format specification means telling the model exactly what structure you want — JSON, Markdown, numbered list, table, etc. Without this, models often vary their format unpredictably across requests.
4 / 25
What is a 'constraint' in a prompt, and why is it useful?
Constraints bound the model's response to meet specific requirements — length limits, format restrictions, topic scope, or exclusions. They help make outputs more predictable and fit for purpose.
5 / 25
What does 'context setting' mean at the start of a prompt?
Context setting means front-loading relevant background into the prompt so the model can produce a more accurate, tailored response — for example, 'We have a React app using TypeScript and Redux. The following component has a performance issue...' before asking for help.
6 / 25
Sarah: 'I'm getting inconsistent results from the summarization API. It sometimes returns a very detailed summary, and other times just a single sentence. I've been trying to control this with more specific instructions in the prompt, but it's still happening. Any ideas? I'm worried about the quality of our user reports.
This scenario highlights a common issue in prompt engineering: controlling API output. The correct answer focuses on the role of constraints – specifically limiting the desired length of the summary. While APIs can vary in their behavior, providing explicit constraints like 'maximum 100 words' helps guide the model and reduces unpredictable variations. The other options represent misconceptions; simply adding more detail isn't always effective, and an unreliable API shouldn't be treated as a substitute for well-defined prompts.
7 / 25
Reviewer: 'The prompt's verbose. It includes a lengthy preamble about the company's mission and values – completely irrelevant to the task of extracting key features from this API response. This is adding unnecessary cognitive load for the model, potentially leading to hallucination. PR Description: 'Please refine the prompt to focus solely on the data extraction requirements, omitting any extraneous context.' What does 'cognitive load' mean in this context?
This question tests understanding of 'cognitive load' as it relates to prompt engineering. While 'cognitive load' technically refers to the mental effort a system (like a model) requires, in this scenario, the preamble is *effectively* increasing the model's workload by providing irrelevant information, which can lead to errors and reduced accuracy – essentially creating unnecessary complexity. The reviewer is highlighting how extraneous context negatively impacts the model's performance; option A refers to hardware specifications, C to data transfer volume, and D to operational costs.
8 / 25
During a Slack discussion about optimizing the chatbot's responses, Liam says: 'I'm trying to avoid *prompt injection* – where the user tricks the model into doing something it shouldn't.' Maya replies, 'That's great! We need to carefully sanitize all inputs and use techniques like *input validation* to mitigate that risk.' What is the primary difference in meaning between 'prompt injection' and 'input validation' as Liam and Maya are discussing them?
The key distinction lies in their roles. 'Prompt injection' describes a specific *attack* – a user deliberately crafting a prompt to bypass safeguards and achieve unintended behavior. 'Input validation', conversely, represents a defensive strategy; it's the process of examining and filtering incoming data (the 'input') to ensure it meets pre-defined criteria and doesn't contain malicious elements like those used in a prompt injection attack. Therefore, Liam is referring to an exploitable vulnerability, while Maya is outlining a security measure.
9 / 25
PR Description: 'The prompt is failing to consistently generate JSON output. It appears the model is interpreting the natural language instructions as a request for a textual description instead of structured data. We need to explicitly define the expected JSON schema in the prompt.' Consider this scenario: During a code review, your colleague points out this issue and suggests adding a `schema_definition` parameter to the prompt. What does 'schema definition' mean in this context?
The term 'schema definition' refers to precisely how the model should structure its response. It goes beyond simply stating what data is *needed*; it dictates the format – the specific fields, their data types (string, number, boolean), and any constraints on their values. Misunderstanding this can lead the model to generate unstructured text instead of conforming to a structured JSON output. Option A is a technical detail about the model itself; option C focuses on debugging code, while option D relates to understanding the user's initial requirement.
10 / 25
Reviewer: 'The prompt is returning a list of strings instead of the desired JSON object. The model seems to be prioritizing brevity over structured output. We need to guide it more explicitly towards generating the correct format.'
Which of the following best explains what 'prioritizing brevity over structured output' means in this scenario?
This phrase indicates that the model isn't adhering to the desired output format (JSON) because it's prioritizing a shorter, less structured response. 'Prioritizing brevity' means focusing on conciseness—in this case, generating a minimal answer—rather than following the specified schema or data structure. This is a common issue when models aren't adequately guided toward the intended outcome.
11 / 25
Sarah: 'I'm getting inconsistent results from the summarization API. It sometimes returns a very detailed summary, and other times just a single sentence. I've been trying to control this with more specific instructions in the prompt, but it's still happening. Any ideas? I'm worried about the quality of our user reports.
This scenario highlights a common issue in prompt engineering: controlling API output. The correct answer focuses on the role of constraints – specifically limiting the desired length of the summary. While APIs can vary in their behavior, providing explicit constraints like 'maximum 100 words' helps guide the model and reduces unpredictable variations. The other options represent misconceptions; simply adding more detail isn't always effective, and an unreliable API shouldn't be treated as a substitute for well-defined prompts.
12 / 25
Reviewer: 'The prompt's verbose. It includes a lengthy preamble about the company's mission and values – completely irrelevant to the task of extracting key features from this API response. This is adding unnecessary cognitive load for the model, potentially leading to hallucination. PR Description: 'Please refine the prompt to focus solely on the data extraction requirements, omitting any extraneous context.' What does 'cognitive load' mean in this context?
This question tests understanding of 'cognitive load' as it relates to prompt engineering. While 'cognitive load' technically refers to the mental effort a system (like a model) requires, in this scenario, the preamble is *effectively* increasing the model's workload by providing irrelevant information, which can lead to errors and reduced accuracy – essentially creating unnecessary complexity. The reviewer is highlighting how extraneous context negatively impacts the model's performance; option A refers to hardware specifications, C to data transfer volume, and D to operational costs.
13 / 25
During a Slack discussion about optimizing the chatbot's responses, Liam says: 'I'm trying to avoid *prompt injection* – where the user tricks the model into doing something it shouldn't.' Maya replies, 'That's great! We need to carefully sanitize all inputs and use techniques like *input validation* to mitigate that risk.' What is the primary difference in meaning between 'prompt injection' and 'input validation' as Liam and Maya are discussing them?
The key distinction lies in their roles. 'Prompt injection' describes a specific *attack* – a user deliberately crafting a prompt to bypass safeguards and achieve unintended behavior. 'Input validation', conversely, represents a defensive strategy; it's the process of examining and filtering incoming data (the 'input') to ensure it meets pre-defined criteria and doesn't contain malicious elements like those used in a prompt injection attack. Therefore, Liam is referring to an exploitable vulnerability, while Maya is outlining a security measure.
14 / 25
PR Description: 'The prompt is failing to consistently generate JSON output. It appears the model is interpreting the natural language instructions as a request for a textual description instead of structured data. We need to explicitly define the expected JSON schema in the prompt.' Consider this scenario: During a code review, your colleague points out this issue and suggests adding a `schema_definition` parameter to the prompt. What does 'schema definition' mean in this context?
The term 'schema definition' refers to precisely how the model should structure its response. It goes beyond simply stating what data is *needed*; it dictates the format – the specific fields, their data types (string, number, boolean), and any constraints on their values. Misunderstanding this can lead the model to generate unstructured text instead of conforming to a structured JSON output. Option A is a technical detail about the model itself; option C focuses on debugging code, while option D relates to understanding the user's initial requirement.
15 / 25
Reviewer: 'The prompt is returning a list of strings instead of the desired JSON object. The model seems to be prioritizing brevity over structured output. We need to guide it more explicitly towards generating the correct format.'
Which of the following best explains what 'prioritizing brevity over structured output' means in this scenario?
This phrase indicates that the model isn't adhering to the desired output format (JSON) because it's prioritizing a shorter, less structured response. 'Prioritizing brevity' means focusing on conciseness—in this case, generating a minimal answer—rather than following the specified schema or data structure. This is a common issue when models aren't adequately guided toward the intended outcome.
16 / 25
Sarah: 'I'm getting inconsistent results from the summarization API. It sometimes returns a very detailed summary, and other times just a single sentence. I've been trying to control this with more specific instructions in the prompt, but it's still happening. Any ideas? I'm worried about the quality of our user reports.
This scenario highlights a common issue in prompt engineering: controlling API output. The correct answer focuses on the role of constraints – specifically limiting the desired length of the summary. While APIs can vary in their behavior, providing explicit constraints like 'maximum 100 words' helps guide the model and reduces unpredictable variations. The other options represent misconceptions; simply adding more detail isn't always effective, and an unreliable API shouldn't be treated as a substitute for well-defined prompts.
17 / 25
Reviewer: 'The prompt's verbose. It includes a lengthy preamble about the company's mission and values – completely irrelevant to the task of extracting key features from this API response. This is adding unnecessary cognitive load for the model, potentially leading to hallucination. PR Description: 'Please refine the prompt to focus solely on the data extraction requirements, omitting any extraneous context.' What does 'cognitive load' mean in this context?
This question tests understanding of 'cognitive load' as it relates to prompt engineering. While 'cognitive load' technically refers to the mental effort a system (like a model) requires, in this scenario, the preamble is *effectively* increasing the model's workload by providing irrelevant information, which can lead to errors and reduced accuracy – essentially creating unnecessary complexity. The reviewer is highlighting how extraneous context negatively impacts the model's performance; option A refers to hardware specifications, C to data transfer volume, and D to operational costs.
18 / 25
During a Slack discussion about optimizing the chatbot's responses, Liam says: 'I'm trying to avoid *prompt injection* – where the user tricks the model into doing something it shouldn't.' Maya replies, 'That's great! We need to carefully sanitize all inputs and use techniques like *input validation* to mitigate that risk.' What is the primary difference in meaning between 'prompt injection' and 'input validation' as Liam and Maya are discussing them?
The key distinction lies in their roles. 'Prompt injection' describes a specific *attack* – a user deliberately crafting a prompt to bypass safeguards and achieve unintended behavior. 'Input validation', conversely, represents a defensive strategy; it's the process of examining and filtering incoming data (the 'input') to ensure it meets pre-defined criteria and doesn't contain malicious elements like those used in a prompt injection attack. Therefore, Liam is referring to an exploitable vulnerability, while Maya is outlining a security measure.
19 / 25
PR Description: 'The prompt is failing to consistently generate JSON output. It appears the model is interpreting the natural language instructions as a request for a textual description instead of structured data. We need to explicitly define the expected JSON schema in the prompt.' Consider this scenario: During a code review, your colleague points out this issue and suggests adding a `schema_definition` parameter to the prompt. What does 'schema definition' mean in this context?
The term 'schema definition' refers to precisely how the model should structure its response. It goes beyond simply stating what data is *needed*; it dictates the format – the specific fields, their data types (string, number, boolean), and any constraints on their values. Misunderstanding this can lead the model to generate unstructured text instead of conforming to a structured JSON output. Option A is a technical detail about the model itself; option C focuses on debugging code, while option D relates to understanding the user's initial requirement.
20 / 25
Reviewer: 'The prompt is returning a list of strings instead of the desired JSON object. The model seems to be prioritizing brevity over structured output. We need to guide it more explicitly towards generating the correct format.'
Which of the following best explains what 'prioritizing brevity over structured output' means in this scenario?
This phrase indicates that the model isn't adhering to the desired output format (JSON) because it's prioritizing a shorter, less structured response. 'Prioritizing brevity' means focusing on conciseness—in this case, generating a minimal answer—rather than following the specified schema or data structure. This is a common issue when models aren't adequately guided toward the intended outcome.
21 / 25
Sarah: 'I'm getting inconsistent results from the summarization API. It sometimes returns a very detailed summary, and other times just a single sentence. I've been trying to control this with more specific instructions in the prompt, but it's still happening. Any ideas? I'm worried about the quality of our user reports.
This scenario highlights a common issue in prompt engineering: controlling API output. The correct answer focuses on the role of constraints – specifically limiting the desired length of the summary. While APIs can vary in their behavior, providing explicit constraints like 'maximum 100 words' helps guide the model and reduces unpredictable variations. The other options represent misconceptions; simply adding more detail isn't always effective, and an unreliable API shouldn't be treated as a substitute for well-defined prompts.
22 / 25
Reviewer: 'The prompt's verbose. It includes a lengthy preamble about the company's mission and values – completely irrelevant to the task of extracting key features from this API response. This is adding unnecessary cognitive load for the model, potentially leading to hallucination. PR Description: 'Please refine the prompt to focus solely on the data extraction requirements, omitting any extraneous context.' What does 'cognitive load' mean in this context?
This question tests understanding of 'cognitive load' as it relates to prompt engineering. While 'cognitive load' technically refers to the mental effort a system (like a model) requires, in this scenario, the preamble is *effectively* increasing the model's workload by providing irrelevant information, which can lead to errors and reduced accuracy – essentially creating unnecessary complexity. The reviewer is highlighting how extraneous context negatively impacts the model's performance; option A refers to hardware specifications, C to data transfer volume, and D to operational costs.
23 / 25
During a Slack discussion about optimizing the chatbot's responses, Liam says: 'I'm trying to avoid *prompt injection* – where the user tricks the model into doing something it shouldn't.' Maya replies, 'That's great! We need to carefully sanitize all inputs and use techniques like *input validation* to mitigate that risk.' What is the primary difference in meaning between 'prompt injection' and 'input validation' as Liam and Maya are discussing them?
The key distinction lies in their roles. 'Prompt injection' describes a specific *attack* – a user deliberately crafting a prompt to bypass safeguards and achieve unintended behavior. 'Input validation', conversely, represents a defensive strategy; it's the process of examining and filtering incoming data (the 'input') to ensure it meets pre-defined criteria and doesn't contain malicious elements like those used in a prompt injection attack. Therefore, Liam is referring to an exploitable vulnerability, while Maya is outlining a security measure.
24 / 25
PR Description: 'The prompt is failing to consistently generate JSON output. It appears the model is interpreting the natural language instructions as a request for a textual description instead of structured data. We need to explicitly define the expected JSON schema in the prompt.' Consider this scenario: During a code review, your colleague points out this issue and suggests adding a `schema_definition` parameter to the prompt. What does 'schema definition' mean in this context?
The term 'schema definition' refers to precisely how the model should structure its response. It goes beyond simply stating what data is *needed*; it dictates the format – the specific fields, their data types (string, number, boolean), and any constraints on their values. Misunderstanding this can lead the model to generate unstructured text instead of conforming to a structured JSON output. Option A is a technical detail about the model itself; option C focuses on debugging code, while option D relates to understanding the user's initial requirement.
25 / 25
Reviewer: 'The prompt is returning a list of strings instead of the desired JSON object. The model seems to be prioritizing brevity over structured output. We need to guide it more explicitly towards generating the correct format.'
Which of the following best explains what 'prioritizing brevity over structured output' means in this scenario?
This phrase indicates that the model isn't adhering to the desired output format (JSON) because it's prioritizing a shorter, less structured response. 'Prioritizing brevity' means focusing on conciseness—in this case, generating a minimal answer—rather than following the specified schema or data structure. This is a common issue when models aren't adequately guided toward the intended outcome.
What will I practice in "Prompt Structure — Vocabulary"?
This is an AI Prompting exercise set. It walks through 25 scenario-based multiple-choice questions built around real usage of AI Prompting terminology that IT professionals encounter on the job.
Is this exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is free to complete with no account, sign-up, or paywall.
How many questions are in this exercise?
This set contains 25 questions. Each one shows immediate feedback and a detailed explanation after you answer, so you learn the correct usage right away rather than waiting for a final score.
Do I need prior experience to complete this exercise?
No prior experience is required. Each question includes a full explanation covering the reasoning behind the correct answer, so the exercise itself teaches the AI Prompting vocabulary as you go.
Can I retry the exercise if I get questions wrong?
Yes — use the "Try again" button on the results screen to reset your answers and go through all the questions again. There is no limit on attempts.
Is my progress saved?
Your answers and score for the current session are tracked in the browser as you go. No account or login is needed, and there is nothing to install.
What if I don't understand a term used in a question?
Read the explanation shown after you answer each question — it breaks down the correct term in plain English with a real-world example. You can also check the site Glossary for quick definitions.
How is this different from reading a blog article on the topic?
Exercises like this one are interactive drills that test and reinforce specific vocabulary through multiple-choice questions, while blog articles explain concepts in prose. Practising here after reading builds active recall, not just passive recognition.
Where can I find more AI Prompting exercises?
See the AI Prompting exercises hub for the full set of related pages, or browse all exercise categories from the main Exercises index.
Can I use this exercise to prepare for a technical interview?
Yes — AI Prompting vocabulary comes up often in technical discussions and interviews. Pair this exercise with our dedicated Interview Preparation section for role-specific practice.