Twelve common prompt engineering interview questions
- What is the difference between zero-shot and few-shot prompting?
- What is chain-of-thought prompting, and when does it help?
- How do you get reliable structured output such as JSON?
- What belongs in a system prompt versus a user message?
- How do temperature and top-p affect output?
- How do you evaluate whether one prompt is better than another?
- How do you version and deploy prompts?
- What is prompt injection, and how do you defend against it?
- How do you reduce prompt length and cost?
- What is prompt caching?
- How do you handle ambiguous user requests?
- When should you stop prompting and fine-tune instead?
Techniques, answered briefly
- Few-shot: include a handful of input–output examples; choose diverse, representative ones and keep the format identical to what you want back.
- Reasoning prompts: asking the model to work through steps helps multi-step problems. Many newer models reason internally, so explicit instructions matter less there — but asking for a short justification still aids debugging.
- Structure: clear sections, delimiters around untrusted input, explicit output schema, and instructions for what to do when information is missing.
- System prompt: stable role, rules and format; user messages carry the task and data.
Structured output
Use the provider's structured-output or tool-calling features with a JSON schema where available, because they constrain generation rather than merely asking for JSON. Otherwise, give a schema and an example, set a low temperature, and validate every response in code with a retry that includes the validation error. Keep schemas flat where possible and make fields required only when the model can always fill them.
Evaluating prompts
| Method | When to use it |
|---|---|
| Golden test set | Every change — a few dozen to a few hundred real inputs with expected outputs |
| Programmatic checks | Format, length, required fields, banned content |
| Model-graded rubric | Open-ended quality, validated against human ratings |
| Human review | A sample of outputs, especially edge cases |
| A/B testing online | When user behaviour is the real measure |
Version prompts in source control alongside their test sets, and run the evaluation in CI so a prompt change that breaks ten cases never ships. Interviewers want to hear that you've caught a regression this way.
Prompt injection
Prompt injection is when untrusted input — a user message, a document, a web page — contains instructions that override yours. There is no complete fix, so defend in layers: separate instructions from data with clear delimiters and tell the model to treat the data as content only, minimise the permissions of any tools the model can call, require confirmation for consequential actions, filter outputs, and monitor for anomalies. Never put secrets in prompts the user can extract.
Cost and latency
- Remove redundant instructions; shorter prompts are cheaper and often clearer.
- Put stable content first so provider prompt caching can reuse it across requests.
- Route simple requests to smaller, faster models.
- Stream responses to improve perceived latency.
When to stop prompting
If you need hundreds of examples in the prompt to get consistent behaviour, or the same failure persists across many prompt variants, fine-tuning or retrieval is probably the better tool. Prompting is best for fast iteration and moderate customisation. See generative AI interview questions.
Practising
Reading answers is not the same as saying them. Pick ten of the questions above and answer them aloud against a timer; a free AI interview assistant like CoPilot Interview can ask prompt engineering questions in a mock interview and flag answers that ran long or lacked an example. Bring a real example: a prompt you improved, the test set you used, and the before-and-after numbers.
Disclosure: CoPilot Interview is our product, so weigh what we say about it accordingly. Everything else on this page applies whichever tool you use, or none.
Frequently asked questions
What is asked in a prompt engineering interview?
Few-shot and reasoning prompts, structured output, system prompts, sampling settings, how you evaluate and version prompts, prompt injection defences, and cost and latency optimisation.
How do you evaluate a prompt?
Run it against a golden test set of real inputs with expected outputs, add programmatic format checks, use rubric-based model grading validated against humans, and review samples manually.
How do you defend against prompt injection?
In layers: separate instructions from untrusted data, minimise tool permissions, require confirmation for consequential actions, filter outputs, monitor, and never place secrets in prompts.
Is prompt engineering still a job in 2026?
As a standalone title it's rarer; as a skill it's part of AI engineering, product and applied science roles, with more emphasis on evaluation, structured output and safety than on wording.
Practise on real interview questions
Run 145 real interview questions across 10 tracks, answer out loud and see a structured answer to compare with yours. Free, no signup.
Try a practice question