Prompt engineering interview questions
Writing clear instructions, examples, structure, and system prompts. Ten practice questions with answers, for AI Engineer interviews.
What's usually the single most effective improvement to a weak prompt?
- Being clear and specific about the task, context, and desired output
- Adding 'please' and 'thank you'
- Writing in all caps
- Making it as short as possible
Show answer
Being clear and specific about the task, context, and desired output
Models do what you say, not what you meant. Missing context is the most common cause of poor output.
What is few-shot prompting?
- Including a few input→output examples in the prompt
- Calling the API a few times and averaging
- Fine-tuning on a few examples
- Limiting output to a few tokens
Show answer
Including a few input→output examples in the prompt
Examples show format and style. They're in-context only; no weights change, unlike fine-tuning.
Give three things a good prompt for summarising customer support tickets should specify.
Show answer
Who the summary is for and why (audience and purpose), what to include or focus on (e.g. issue, steps tried, resolution, sentiment), and the output format and length (e.g. 3 bullet points, JSON fields). Also useful: how to handle missing information and examples of good summaries.
Audience, content, and format are the core of most good prompts.
System prompt
Show answer
Instructions set by the developer that frame the model's role, rules, and context for the whole conversation, separate from user messages.
Put stable instructions here; put per-request data in user messages.
Explain why telling a model what TO do usually works better than only telling it what NOT to do.
Show answer
Negative instructions name the unwanted behaviour, which can prime it, and they leave the model guessing what to do instead. Positive instructions describe the target behaviour directly, so the model has a clear goal. If you need a prohibition, pair it with what to do instead.
e.g. 'Write in plain prose paragraphs' beats 'Don't use markdown'.
Chain-of-thought prompting
Show answer
Asking the model to reason step by step before giving a final answer, which tends to improve accuracy on multi-step problems.
Many modern models do this internally via 'thinking'; you then just ask for the answer.
Your examples all start with 'Great question!' and now every output does too. What's the best fix?
- Vary the examples so they don't share incidental patterns
- Remove all examples forever
- Raise temperature to 2
- Add 'never say great question' in all caps
Show answer
Vary the examples so they don't share incidental patterns
Models copy whatever is consistent across examples, including accidents. Diverse examples teach the intended pattern.
Why wrap user-provided documents in tags like <document>…</document>?
- It separates data from instructions so the model is less likely to follow injected text
- Tags make the request cheaper
- The API requires XML
- It guarantees the model can't be prompt-injected
Show answer
It separates data from instructions so the model is less likely to follow injected text
Delimiters help, but they're one layer of defence, not a guarantee.
Prompt chaining
Show answer
Splitting a complex task into several model calls where each call's output feeds the next.
Easier to debug and evaluate than one giant prompt, at the cost of latency.
How would you systematically improve a prompt that works 80% of the time?
Show answer
Build an eval set of representative and failing cases with a clear pass criterion, measure the baseline, inspect the failures to find patterns, change one thing at a time (clarify instructions, add context or examples, restructure, split into steps), re-run the eval each time, and keep changes that improve the score without regressions.
Prompt engineering is empirical; without an eval you're guessing.
Practise these with spaced repetition and AI grading, then try a mock interview.
Start Learning Free