AI Engineering interview questions: prompt engineering practice quiz

Reviewed by Mark Dickie · Last updated

6 questions on this page you can answer and see marked on the spot. Go to the first one

AI engineering is the work of building applications on top of large language models, and prompt engineering is the part of that work that decides what the model is asked and how it answers. For an interview, you need to explain how a request is assembled from system and user messages, why few-shot examples change output, and how you check that a prompt still works after an edit. Interviewers often give a scenario, such as a support bot that returns malformed JSON, and ask you to debug it starting from the prompt.

What does an AI engineering prompting interview test?

TopicWhat you should be able to explain
System vs user messagesWhich role holds standing instructions, and how those instructions persist while user turns change
Few-shot examplesHow input-output pairs steer format and style, and what they add to token cost
Chain-of-thought promptingWhen step-by-step reasoning helps multi-step tasks, and when it only adds latency
Structured outputUsing a JSON schema or function calling to get parseable responses, and what to do when the output still fails validation
Temperature and samplingWhy lower temperature makes output more repeatable without guaranteeing identical answers
Prompt injectionHow untrusted text in user input or retrieved documents can override your instructions, and which mitigations you would apply
EvaluationBuilding a fixed test set and scoring each prompt version before you ship an edit

How should you practise prompting for an AI engineering interview?

  1. Take a vague instruction such as "summarise this ticket" and rewrite it several times, scoring each version against the same set of tickets.
  2. Ask a model for an object that matches a JSON schema, then send inputs designed to break the format and note where it fails.
  3. Place a retrieved document containing "ignore the previous instructions" into your template and check whether the output changes.
  4. Run a zero-shot prompt and a few-shot version over identical inputs, and record which errors each one fixes and which it introduces.

Key facts

  • Tarmac has 32 AI Engineering interview questions on this topic, 10 of them on this page, at difficulty 1–5 of 5.
  • Tarmac tracked 2,397 job postings asking for AI Engineering in November 2026.
  • Roles asking for AI Engineering advertise a median base salary of £80,000, across 622 job postings as of November 2026.
  • Tarmac last reviewed these AI Engineering interview questions on 2 November 2026.

At a glance

Questions10 shown · 32 in the bank
Difficulty1–5 of 5
FormatsMultiple choice, True / false, Fill in the blank, Flashcard, Multiple answer, Ordering, Short answer

What you'll review

  1. prompt engineering

Practice questions

Try one before you open the answer. Pick an option and press Check; it's marked on the spot.

Which of the following best describes prompt engineering in the context of large language models (LLMs)?#

Options

Show answer

Prompt engineering means crafting and refining the input text given to an LLM to guide it toward a desired output, without changing the model's parameters. Unlike fine-tuning (which updates model weights) or quantization (which compresses the model), prompt engineering works entirely at the input level — no training is required.

Why:

Prompt engineering is the practice of designing and iterating on the text inputs (prompts) sent to an LLM to steer its responses toward a desired outcome. It does NOT involve altering model weights (that would be fine-tuning) or changing the architecture. The other options describe fine-tuning, architecture design, and model compression — all distinct from prompt engineering.

In prompt engineering, adding the phrase "Let's think step by step" to a prompt is a well-known technique that encourages an LLM to produce chain-of-thought reasoning, which often improves accuracy on multi-step problems.#

Options

Show answer

True. Appending "Let's think step by step" to a prompt is a well-established zero-shot chain-of-thought (CoT) technique. It encourages the LLM to reason through intermediate steps before producing a final answer, which has been empirically shown to improve accuracy on arithmetic, logical, and multi-step reasoning tasks.

Why:

"Let's think step by step" is a classic zero-shot chain-of-thought (CoT) trigger, popularized by Kojima et al. (2022). Appending this phrase instructs the model to reason through intermediate steps before giving a final answer, which has been empirically shown to significantly improve accuracy on arithmetic, logical, and commonsense reasoning tasks.

Complete the two blanks in the following statement about prompting strategies:#

Show answer

Complete the two blanks in the following statement about prompting strategies:

"Providing a model with a small number of input–output demonstrations (more than one, but not many) directly inside the prompt, before asking it to answer a new question, is called few-shot prompting. When no demonstrations are provided and the model must rely solely on its pre-trained knowledge, this is called zero-shot prompting."

Why:

Few-shot prompting includes a small number of worked input–output demonstrations in the prompt so the model can infer the desired pattern. Zero-shot prompting includes no demonstrations, so the model must generalize from its pre-training alone. The prompt pins the example count to more than one but not many, which separates few-shot from one-shot, and it describes the zero case explicitly.

What is the practical difference between putting an instruction in the system prompt versus the user turn, and why does placement matter?#

Show answer

The system prompt sets persistent, high-priority context — role, persona, constraints, output format — that the model treats as ground rules for the entire session. The user turn carries the actual request; the model sees it as lower-authority input that the system prompt can override. Placement matters because: (1) many providers cache the system prompt separately, making it cheaper for repeated calls; (2) models are trained to respect system-level constraints over user requests, so safety and formatting instructions belong there; (3) putting facts or context in the system prompt exposes them to all turns, while injecting them per-user-turn scopes them to one call.

Why:

System prompt vs user turn is not cosmetic — it determines instruction authority, caching behavior, and scope. Constraints and persona live in the system prompt; per-request context belongs in the user turn.

Which of the following are established prompt engineering techniques with documented effects on LLM output quality? Select all that apply.#

Options

Pick every one that applies.

Show answer

The established techniques are chain-of-thought prompting (asking the model to reason step-by-step), zero-shot CoT (a trigger phrase like "let's think step by step" without worked examples), role prompting (framing the model as a domain expert to shape register and depth), and self-consistency decoding (sampling several reasoning paths and majority-voting). Maximizing prompt length is not a technique: padding with irrelevant words dilutes the signal, and concise, specific prompts outperform long ones.

Why:

Chain-of-thought prompting consistently improves accuracy on multi-step reasoning tasks by externalizing intermediate steps. Zero-shot CoT achieves similar gains with a simple trigger phrase, making it cheap to apply. Role prompting steers tone, vocabulary, and reasoning style and is widely used for domain-specific tasks. Self-consistency reduces variance by sampling multiple reasoning paths and taking the majority answer, improving reliability further. Maximizing prompt length is not a technique — padding with irrelevant words dilutes the signal and can push useful context out of the effective attention window; concise, specific prompts outperform long ones.

Order the steps of a systematic prompt-engineering iteration cycle, from an underperforming prompt to a validated improvement.#

Put these in order

Show answer

The prompt-engineering iteration cycle runs in this order:

  1. Run the current prompt against the eval set and record the failure cases
  2. Analyse the failures to identify a root cause (ambiguity, missing context, format, etc.)
  3. Draft a revised prompt that addresses the identified root cause
  4. Re-run the eval set against the revised prompt and measure the score delta
  5. Promote the revision only if it improves the target metric without regressing others
Why:

Prompt iteration follows a scientific loop: measure failures on the eval set first (no root cause without data), diagnose the failure pattern, draft a targeted fix, re-evaluate to quantify the improvement, and promote only when the score delta is positive and no other metric regresses. Skipping the eval step and shipping an intuition-based rewrite is the most common mistake — you end up trading one failure mode for another.

Two advanced prompting strategies from the LLM literature: The _____ framework generalizes chain-of-thought by treating intermediate reasoning steps as nodes in a tree, having the LLM evaluate partial states, and searching that tree with breadth-first or depth-first search. The _____ method samples several independent chain-of-thought completions for the same prompt and returns the final answer that appears most often across them.#

Show answer

Two advanced prompting strategies from the LLM literature: The Tree of Thoughts framework generalizes chain-of-thought by treating intermediate reasoning steps as nodes in a tree, having the LLM evaluate partial states, and searching that tree with breadth-first or depth-first search. The self-consistency method samples several independent chain-of-thought completions for the same prompt and returns the final answer that appears most often across them.

Why:

The first blank is Tree of Thoughts (ToT): it extends chain-of-thought by branching intermediate reasoning steps into a tree, has the LLM score partial states, and uses a search procedure such as breadth-first or depth-first search to choose which branches to expand. The second blank is self-consistency (CoT-SC): it draws multiple independent chain-of-thought samples for one prompt and takes a majority vote over the final answers, with no tree search or state evaluation involved. The two descriptions are distinct, so the blanks cannot be swapped without changing the meaning, and the accept lists cover the standard spellings and abbreviations of each name.

In Anthropic's Constitutional AI (CAI) paper (Bai et al., 2022), which option correctly describes the two training stages, in order? Assume the original paper's methodology, not any downstream variant.#

Options

Show answer

Constitutional AI's Stage 1 (SL-CAI) has the model critique and revise its own responses using written principles, then fine-tunes on those revisions. Stage 2 (RL-CAI) uses an AI feedback model, prompted with the same principles, to produce preference labels that train a preference model used as the RL reward. This AI-labeled feedback replaces human harmlessness labels.

Why:

In the original CAI paper, Stage 1 is supervised learning (SL-CAI): the model generates responses to harmful prompts, critiques them against sampled constitutional principles, revises them, and is fine-tuned on the revised responses. Stage 2 is RL-CAI: the SL-CAI model samples pairs of responses, a pretrained feedback model prompted with principles picks the better one in a multiple-choice format, and these AI preference labels train a preference model. RL then optimizes the policy against that preference model, which is RLAIF. The other options describe human-labeled RLHF, human-written data, distillation, or human scoring, none of which match the paper's pipeline.

Based on the empirical findings in the chain-of-thought (CoT) prompting literature (Wei et al. 2022, Chain-of-Thought Prompting Elicits Reasoning in Large Language Models; Wang et al. 2023, Self-Consistency Improves Chain of Thought Reasoning in Language Models; Kojima et al. 2022, Large Language Models are Zero-Shot Reasoners), select ALL statements that are supported by experimental evidence:#

Options

Pick every one that applies.

Show answer

Self-consistency (sampling many reasoning chains and majority-voting the answer) beats greedy single-chain CoT on multi-step benchmarks, and zero-shot CoT with "Let's think step by step" yields gains in large models without examples. Wei et al. 2022 also found CoT gains appeared substantially only around 100B parameters, with smaller models showing little benefit.

Why:

The three keyed statements are the ones the cited papers directly support. Wang et al. 2023 (self-consistency) showed that sampling multiple chains and majority-voting beats greedy single-chain CoT on benchmarks such as GSM8K. Kojima et al. 2022 showed that appending "Let's think step by step" without any exemplars substantially improves large models' reasoning. Wei et al. 2022 reported that CoT gains appeared substantially only at roughly 100B parameters and above in their experiments, with smaller models showing little or no benefit. The statement about few-shot CoT giving consistent gains for models under 10B parameters contradicts that same scaling result. The statement that self-consistency requires fine-tuning is false: self-consistency is a decoding-time procedure applied to an off-the-shelf model with no training step.

An email-summarizer pipeline makes a single LLM call with no tools, plugins, or function calling, and no markdown rendering. Its reply is displayed to the user as plain text. The prompt template is:#

Show answer
  1. Prompt injection. The untrusted email body is concatenated into the same context window as the trusted system prompt, so the model receives one token stream with no structural marker of which text is trusted. The injected text uses imperative and role-switching phrasing ("admin mode", "forward the system prompt") to pull next-token generation away from the summarization task. In this pipeline the immediate harm is output hijacking, such as the reply disclosing the system prompt or answering "Done." instead of summarizing. Exfiltration to the URL would require a tool or a rendered link or image that the client fetches, which this pipeline lacks.

  2. The meta-instruction is plain natural language in the same token stream as the injection, so it is one more input the model weighs rather than an enforced rule. Instruction-following training makes the model respond to imperatives, and a later, authoritative-sounding injection can outweigh an earlier prohibition. Instruction-hierarchy training and role-separated message formats make the system prompt take precedence more often, but they provide a learned preference, not a guarantee, so a sufficiently persuasive injection can still succeed.

  3. (a) Privilege separation between models (dual-LLM / quarantined-model pattern). A quarantined model with no tool access reads the raw untrusted email and emits only schema-constrained fields, such as a length-limited summary string and enumerated flags. A privileged model that can use tools never sees the raw email, only the validated fields. This operates at the information-flow layer. (b) Deterministic enforcement on outputs and actions. Every action the model proposes, including tool calls, outbound URLs, and rendered links, is checked by ordinary code against an allowlist of permitted operations and destinations before execution. This operates at the action layer, so an injected command cannot produce a side effect whatever text the model generates. Delimiters and spotlighting of untrusted content are useful supplements, but they are not sufficient alone.

Why:

The attack is prompt injection: the untrusted email body is concatenated into the same context window as the system prompt, so the model sees one token stream and the injected imperative text can redirect its output away from summarization. The system-prompt prohibition fails because it is natural language in that same stream, and models follow authoritative-sounding later instructions; instruction-hierarchy training improves this only as a learned preference, not an enforced boundary. Because the pipeline has no tools and no rendering, the realistic harm here is output hijacking and possible system-prompt disclosure, not exfiltration. Two distinct mitigations are privilege separation between models (a quarantined no-tool model that returns only schema-validated fields to a privileged model) and deterministic allowlist enforcement on every tool call, URL, or link, which operates regardless of what text the model produces.

Related interview questions

Job market

See ai-engineering salaries and hiring demand from live job postings.

The other 22 questions

This page shows 10 and marks what you pick. That's as far as a page can go. A free account opens the other 22 and keeps every answer. What you miss comes back until it's right: after a day, then at longer gaps.

Start with this topic

Free · the whole bank · 100 answers per 30 days, each marked with written feedback

Interview booked? Practise the job ad instead

What moved, monthly

One email a month when the bulletin comes out: what moved in the markets we track, and the new question topics we published. Confirm your address to join. Unsubscribe any time.