Stop 22 · Interview PreparationTechnical · 6/8

Prompt Engineering Questions

Part of the AI Engineer Roadmap

In short

"How would you get the model to return valid JSON every time?" Prompt questions test whether you can make an LLM behave reliably, not just impressively once. Concrete techniques beat vague tips.

Practical questions testing whether you can reliably get structured, correct behavior out of an LLM — often framed as 'how would you prompt for X.'

The purple blob holds up a sample plate of food while explaining to a new cook in a kitchen.

Think of it like this

Briefing a new cook at home

Tell a new cook "make something nice" and anything could arrive. Say "two rotis, dal with less salt, no onion, served by 8" and show them yesterday's plate, and you get what you wanted. A prompt works the same way: a clear role, exact rules, one good example and the output format.

Watch it happen

Fixing a flaky JSON prompt

Your app
LLM
Validator

"Classify this ticket"

1/7A vague prompt with no format. The model is left to guess what you want.

The big ideas

What you need to know

Be specific and closed

List allowed labels, say what to do when unsure, and state the exact output format.

Show, don't just tell

One or two examples of input and correct output teach format and tone better than paragraphs of rules.

Use structured output features

Where the API supports JSON mode or schemas, use them, and still validate the result in code.

Separate data from instructions

Fence user text with clear delimiters, so a ticket saying "ignore your rules" is treated as data.

See it in code

Walk through the code

text
1You are a support ticket classifier.2 3Task: read the ticket and return JSON only, no extra words.4Allowed intents: "refund", "delivery_delay", "login_issue", "other".5If unsure, use "other". Never invent an order ID.6 7Example8Ticket: "Paid 2 days ago, order #A12 still not shipped"9Output: {"intent": "delivery_delay", "order_id": "A12", "urgent": false}10 11Ticket: """{ticket_text}"""12Output:

1/3Exact task, closed set of labels, and what to do when the model isn't sure.

A prompt you can walk an interviewer through: role, task, closed label set, a rule for unclear cases, one example, and the user's text fenced in triple quotes.

Save yourself the pain

Common mistakes

Oops

Answering "I'd tell it to be accurate and not hallucinate."

Do this instead

Name techniques: closed label sets, examples, delimiters, structured output, validation and a retry path.

Oops

Judging a prompt change by one or two good-looking outputs.

Do this instead

Run it on a fixed set of 30 to 50 inputs and compare scores before and after the change.

Your mission

Make a prompt reliable

~35 min

Quick check

Your model sometimes returns JSON wrapped in friendly sentences. What's the strongest fix?

Go deeper

  1. 1Practice live prompt-writing for a given task and explaining your reasoning.
  2. 2Be ready to discuss few-shot vs. zero-shot and when each is the better choice.
  3. 3Prepare an example of a prompt you iterated on and why the final version worked better.

More technical at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge