Prompt Engineering interview questions

31 questions from the Prompt Engineering course, each with the correct answer and an explanation. Try to answer before you open the answer.

Foundations of Prompting

1. What is prompt engineering, best described?

  1. Retraining the model weights
  2. Finding secret magic words
  3. Designing and testing inputs so model output is useful and consistent
  4. Writing longer prompts always
Show answer

Answer: Designing and testing inputs so model output is useful and consistent

It is a design-and-measure discipline, not a trick.

Lesson: What Prompt Engineering Is

2. Why must you include facts the model may not know?

  1. It only has the prompt plus its training, not your private data
  2. Models forget their training
  3. Facts shorten the reply
  4. It is a rule of HTTP
Show answer

Answer: It only has the prompt plus its training, not your private data

Missing facts lead to guesses, so supply them in the prompt.

Lesson: How Models Read Your Prompt

3. Why separate the input from the instructions?

  1. Because models cannot read inputs
  2. To hide the prompt
  3. To save a token
  4. So the model can tell what to do from what to process
Show answer

Answer: So the model can tell what to do from what to process

Clear separation avoids confusion and reduces injection risk.

Lesson: The Anatomy of a Good Prompt

4. Where should stable rules and persona go?

  1. Only in the last user message
  2. In the system message
  3. In a comment
  4. Nowhere
Show answer

Answer: In the system message

The system message carries instructions that apply to the whole conversation.

Lesson: System, User and Assistant Messages

Core Techniques

5. Which prompt is better?

  1. "Summarise this"
  2. "Summarise for the CFO in 5 bullets, under 20 words each"
  3. "Do something useful"
  4. "Be smart"
Show answer

Answer: "Summarise for the CFO in 5 bullets, under 20 words each"

Specific audience, length and format leave less to guesswork.

Lesson: Be Clear and Specific

6. What does few-shot prompting add?

  1. Automatic fine-tuning
  2. More model parameters
  3. A faster GPU
  4. Input-output examples that show the desired pattern
Show answer

Answer: Input-output examples that show the desired pattern

Examples let the model infer format and labels without retraining.

Lesson: Few-Shot Examples

7. What does naming the audience change?

  1. Depth, vocabulary and examples
  2. The model size
  3. The tokenizer
  4. The price per token
Show answer

Answer: Depth, vocabulary and examples

The same facts are presented differently for different readers.

Lesson: Role, Audience and Tone

8. If a program reads the reply, what should you do?

  1. Ask for a poem
  2. Hope the format is right
  3. Request a machine-readable format and validate it in code
  4. Disable the system prompt
Show answer

Answer: Request a machine-readable format and validate it in code

Models sometimes deviate, so verify before using.

Lesson: Controlling the Output Format

9. Why wrap input in tags?

  1. To change the language
  2. To compress the text
  3. To mark clearly what is data and what are instructions
  4. To avoid tokens
Show answer

Answer: To mark clearly what is data and what are instructions

Clear boundaries reduce confusion and injection risk.

Lesson: Delimiters and Separating Data from Instructions

Reasoning and Multi-Step Tasks

10. Why put the final answer on a fixed line?

  1. So your code can parse it reliably
  2. To hide the reasoning
  3. To lower the price
  4. To skip the steps
Show answer

Answer: So your code can parse it reliably

A predictable marker makes extraction simple.

Lesson: Step-by-Step Reasoning (Chain of Thought)

11. What does low agreement among samples suggest?

  1. The API is down
  2. The answer is certainly right
  3. The prompt is too short to run
  4. The model is uncertain and the case may need review
Show answer

Answer: The model is uncertain and the case may need review

Disagreement is a useful uncertainty signal.

Lesson: Self-Consistency: Sample Several, Take the Majority

12. What is a benefit of prompt chaining?

  1. It removes all errors
  2. Each step is simpler to test and debug
  3. It always costs less
  4. It removes the need for validation
Show answer

Answer: Each step is simpler to test and debug

Smaller focused steps are easier to evaluate and fix.

Lesson: Prompt Chaining and Decomposition

13. Which check is most independent of the model's own opinion?

  1. Asking "are you sure?"
  2. Running the generated code against tests
  3. Repeating the same prompt
  4. Making the answer longer
Show answer

Answer: Running the generated code against tests

Executable tests give objective evidence.

Lesson: Self-Critique and Verification

Structured Output and Validation

14. Why validate JSON even with a JSON mode?

  1. It is only for XML
  2. JSON mode is illegal
  3. Validation makes JSON longer
  4. Valid syntax does not guarantee correct values or allowed categories
Show answer

Answer: Valid syntax does not guarantee correct values or allowed categories

Schema and value checks catch semantic errors that syntax checks miss.

Lesson: Asking for JSON and Validating It

15. What should you add to a retry prompt?

  1. A specific description of what was wrong with the last reply
  2. Nothing
  3. A longer persona
  4. A random seed only
Show answer

Answer: A specific description of what was wrong with the last reply

Concrete error feedback helps the model correct itself.

Lesson: Retry With Feedback

16. Why ask for supporting quotes?

  1. To skip validation
  2. To make the reply longer
  3. Code can verify each value appears in the source
  4. To change the model
Show answer

Answer: Code can verify each value appears in the source

A quote can be checked mechanically, catching invented values.

Lesson: Extraction Patterns and "Unknown" Handling

Context: Budgets, Memory and Retrieval

17. When history is too long, what is usually dropped first?

  1. The user's latest question
  2. The system rules
  3. The oldest, least relevant messages
  4. The reserved room for the answer
Show answer

Answer: The oldest, least relevant messages

Old chatter matters least; rules and the current turn matter most.

Lesson: Context Windows and Token Budgets

18. Where is it usually best to place the question in a long prompt?

  1. After the documents, near the end
  2. Hidden in the middle of the documents
  3. Never
  4. Before the system prompt
Show answer

Answer: After the documents, near the end

Ending with the question and key rules makes them salient.

Lesson: Long Prompts: Order and Placement

19. Why tell the model to say so when the context lacks the answer?

  1. To change the language
  2. To lengthen replies
  3. To skip retrieval
  4. To prevent confident guessing
Show answer

Answer: To prevent confident guessing

An allowed "not found" answer discourages invention.

Lesson: Grounding With Retrieved Documents

20. Why is conversation memory something you must build?

  1. Models have no tokens
  2. The model does not remember earlier calls by itself
  3. Memory is illegal
  4. APIs forbid history
Show answer

Answer: The model does not remember earlier calls by itself

Each API call only sees what you include in it.

Lesson: Conversation Memory and Summarisation

Safety and Robustness

21. Which design limits damage from a successful injection?

  1. Giving the model admin keys
  2. Least-privilege tools and human approval for risky actions
  3. Hiding the prompt only
  4. Longer prompts
Show answer

Answer: Least-privilege tools and human approval for risky actions

Bounding what a tricked model can do bounds the harm.

Lesson: Prompt Injection and Defences

22. Which should never be put in a prompt?

  1. An example output
  2. A style guide
  3. A public FAQ
  4. API keys and passwords
Show answer

Answer: API keys and passwords

Secrets in prompts can leak through logs or model output.

Lesson: Privacy, Secrets and Responsible Use

23. If system, user and retrieved text conflict, what is a sensible priority?

  1. System rules first, then the user, then retrieved text
  2. Retrieved text first
  3. Whichever is longest
  4. Random
Show answer

Answer: System rules first, then the user, then retrieved text

Trusted instructions should outrank untrusted data.

Lesson: Handling Refusals, Uncertainty and Off-Topic Requests

Evaluating and Operating Prompts

24. Why re-run the whole test set after every prompt change?

  1. To avoid versioning
  2. To make prompts longer
  3. A fix for one case can break others
  4. It is required by the tokenizer
Show answer

Answer: A fix for one case can break others

Regression testing catches unintended side effects.

Lesson: Building a Test Set and Harness

25. What should be logged with each model call?

  1. Only the date
  2. Nothing
  3. Prompt version, model name and settings
  4. The user's password
Show answer

Answer: Prompt version, model name and settings

Reproducibility requires knowing exactly what produced each output.

Lesson: Versioning and Change Control for Prompts

26. Why does a long fixed prompt prefix matter for cost?

  1. It is paid for on every single call
  2. It is free
  3. It is paid once per year
  4. It reduces output tokens
Show answer

Answer: It is paid for on every single call

Fixed overhead multiplies with call volume.

Lesson: Cost, Latency and Prompt Length

27. What closes the improvement loop?

  1. Changing models randomly
  2. Ignoring complaints
  3. Deleting logs
  4. Adding real failures to the test set before changing the prompt
Show answer

Answer: Adding real failures to the test set before changing the prompt

Failures become permanent regression tests.

Lesson: Monitoring and Continuous Improvement

Putting It Together

28. Why is the ticket wrapped in tags and treated as data?

  1. To shrink the prompt
  2. Customer text may contain instructions the model should not follow
  3. Because tickets are in JSON
  4. To remove the need for tests
Show answer

Answer: Customer text may contain instructions the model should not follow

Separating data from instructions is the first line of defence against injection.

Lesson: Case Study: A Support-Ticket Triage Prompt

29. A model keeps wrapping its JSON in friendly text and breaks your parser. What is the best combined fix?

  1. Add more friendly words
  2. Request JSON only, use JSON mode if available, validate and retry with the error
  3. Increase the temperature
  4. Remove the schema
Show answer

Answer: Request JSON only, use JSON mode if available, validate and retry with the error

Combine clear instructions, constrained output and code validation.

Lesson: Revision: Cheat Sheet and Self-Check

30. You changed a prompt and one test case improved. What must you still do?

  1. Double the temperature
  2. Nothing, ship it
  3. Delete the other cases
  4. Re-run the whole test set to check for regressions
Show answer

Answer: Re-run the whole test set to check for regressions

Improvements in one case can hide breakages in others.

Lesson: Revision: Cheat Sheet and Self-Check

31. What best reduces the impact of prompt injection through a web page the assistant reads?

  1. Treat the page as data, limit tool privileges and require approval for risky actions
  2. Trust the page fully
  3. Give the model admin rights
  4. Hide the system prompt only
Show answer

Answer: Treat the page as data, limit tool privileges and require approval for risky actions

Defence in depth bounds what a tricked model can do.

Lesson: Revision: Cheat Sheet and Self-Check

← Back to the course