Skip to content

AI-103 · Domain 2: Implement generative AI and agentic solutions · 33% of the exam

Task 2.3: Optimize and operationalize generative AI systems

Prompt engineering and model parameters, reflection and self-critique loops, tracing with token, safety and latency signals, and orchestrating several models, flows or rules engines.

Study it

Sample questions

Try each one before opening the answer. Every option is explained, with the Microsoft documentation page that proves it.

Question 1 · choose 1

A non-reasoning chat model labels support tickets with one of eight categories. Running the same ticket twice sometimes gives different labels, and the team wants more consistent output without changing the model. Which parameter change helps most?

  1. ALower the temperature toward 0
  2. BRaise the presence penalty
  3. CRaise the maximum output tokens
  4. DRaise top_p to 1 and temperature to 1.5
Show the answer and why
  • ALower the temperature toward 0

    Correct

    Lower temperature makes sampling more focused and deterministic, so repeated runs agree more often.

  • BRaise the presence penalty

    Incorrect

    Presence penalty discourages repeating tokens; it doesn't stabilize a classification.

  • CRaise the maximum output tokens

    Incorrect

    A one-word label isn't limited by output length.

  • DRaise top_p to 1 and temperature to 1.5

    Incorrect

    Both changes widen sampling and make labels vary more.

Temperature and top_p control randomness. For classification and extraction, use a low temperature (and change temperature or top_p, not both) so the model returns its most likely answer.

Question 2 · choose 1

A reasoning model answers both hard planning questions and simple yes-or-no checks in the same app. The simple checks take too long and use many reasoning tokens. The team wants to keep the model. What should they change for the simple checks?

  1. AAsk for the reasoning steps to be written in the visible answer
  2. BSend them with a lower reasoning_effort value
  3. CAdd a few-shot block of hard examples to every request
  4. DRaise max_output_tokens so reasoning finishes sooner
Show the answer and why
  • AAsk for the reasoning steps to be written in the visible answer

    Incorrect

    Visible chain-of-thought adds output tokens on top of the hidden reasoning.

  • BSend them with a lower reasoning_effort value

    Correct

    reasoning_effort controls how much the model thinks before answering; lower values spend fewer reasoning tokens.

  • CAdd a few-shot block of hard examples to every request

    Incorrect

    Longer prompts add input tokens and latency to simple checks.

  • DRaise max_output_tokens so reasoning finishes sooner

    Incorrect

    A higher cap allows more tokens; it doesn't make the model think less.

reasoning_effort sets how much a reasoning model thinks before it answers, so tune it per request type: low for simple checks, higher for hard planning.

Question 3 · choose 1

A writing assistant drafts policy summaries. The team adds a reflection step: a second model call reviews each draft against a rubric of five criteria and the drafter revises it. Costs spike because some drafts bounce between drafting and review for many rounds. How should the loop be designed?

  1. ARemove the review and raise the drafter's temperature for variety
  2. BKeep looping until two consecutive drafts are identical
  3. CStop when the review passes all criteria or after a few fixed rounds
  4. DLet the drafter judge its own draft in the same call, with no rubric
Show the answer and why
  • ARemove the review and raise the drafter's temperature for variety

    Incorrect

    That drops the quality check and adds randomness.

  • BKeep looping until two consecutive drafts are identical

    Incorrect

    Drafts rarely repeat word for word, so this can loop for a long time.

  • CStop when the review passes all criteria or after a few fixed rounds

    Correct

    A bounded loop with a clear pass condition keeps the benefit of critique while capping cost and latency.

  • DLet the drafter judge its own draft in the same call, with no rubric

    Incorrect

    Without explicit acceptance criteria the checker can't make consistent pass or fail decisions.

Reflection loops pair a draft with a critique against explicit criteria, then revise. Give the loop a pass condition and an iteration cap; a rubric-style judge makes the pass condition measurable.

Question 4 · choose 1

A team runs prompt agents in a Foundry project and wants traces of every run, with model calls, tool calls and token counts, as quickly as possible and without changing agent code. What should they do?

  1. AAdd print statements to the agent's instructions
  2. BExport conversations nightly and replay them in a playground
  3. CConnect an Application Insights resource to the Foundry project
  4. DTurn on diagnostic settings for the Foundry resource's audit logs
Show the answer and why
  • AAdd print statements to the agent's instructions

    Incorrect

    Prompt agents have no code to instrument, and instructions don't produce telemetry.

  • BExport conversations nightly and replay them in a playground

    Incorrect

    Replays after the fact don't capture the live spans, timings or token counts.

  • CConnect an Application Insights resource to the Foundry project

    Correct

    Server-side tracing turns on automatically once Application Insights is connected, with no code changes, for agents hosted in Foundry.

  • DTurn on diagnostic settings for the Foundry resource's audit logs

    Incorrect

    Audit logs record operations on the resource; they aren't per-run traces of model calls, tool calls and token counts.

Start with server-side tracing: connect Application Insights to the project and Foundry records traces using OpenTelemetry conventions.

Question 5 · choose 2

A chat app sends the same 6,000-token instruction block at the start of every request, followed by the user's message, and its answers average 1,200 tokens although users read only the first few sentences. Which two changes reduce latency the most? (Choose TWO.)

  1. AAsk for shorter answers and lower the maximum output tokens
  2. BSwitch to a larger model so the cached prefix goes further
  3. CInsert the user's name and the time before the instruction block
  4. DAdd more few-shot examples to the instruction block for accuracy
  5. EKeep the instruction block identical and first in every request
Show the answer and why
  • AAsk for shorter answers and lower the maximum output tokens

    Correct

    Generation size is a major part of latency; fewer generated tokens return faster.

  • BSwitch to a larger model so the cached prefix goes further

    Incorrect

    Latency varies by model, and larger models are generally slower, not faster.

  • CInsert the user's name and the time before the instruction block

    Incorrect

    A changing value at the start breaks the identical prefix that caching needs.

  • DAdd more few-shot examples to the instruction block for accuracy

    Incorrect

    More prompt tokens add processing time rather than removing it.

  • EKeep the instruction block identical and first in every request

    Correct

    Prompt caching reuses an identical prompt prefix, cutting latency and cost for long prompts.

Two levers dominate here: keep long static content at the start so it can be cached, and generate only what users need.

Question 6 · choose 1

A lender wants AI help with loan pre-screening. Applications arrive as free-text emails with attachments, and eligibility must follow fixed thresholds that auditors check line by line, giving the same result for the same facts. Which design fits?

  1. AA model extracts facts into a schema; a rules engine applies thresholds
  2. BA model reads each email and decides eligibility with temperature set to 0
  3. CModel router picks a model per application to decide eligibility
  4. DA model fine-tuned on past decisions decides eligibility directly
Show the answer and why
  • AA model extracts facts into a schema; a rules engine applies thresholds

    Correct

    The model handles unstructured input; deterministic code applies the auditable policy and gives repeatable results.

  • BA model reads each email and decides eligibility with temperature set to 0

    Incorrect

    Low temperature reduces variation but doesn't turn model judgment into the exact, auditable rules the lender needs.

  • CModel router picks a model per application to decide eligibility

    Incorrect

    Routing picks a model for cost or quality but still leaves the decision to a model.

  • DA model fine-tuned on past decisions decides eligibility directly

    Incorrect

    Fine-tuning learns patterns from history; it doesn't guarantee each threshold is applied as written.

Orchestrate each part with the right engine: language models for reading messy input, rules for decisions that must be exact and repeatable. Structured output is the contract between the two.

Question 7 · choose 1

A team's prompt agent has rambling, inconsistent instructions written by several people. They want a tool in the Foundry portal that restructures and clarifies the instructions using prompt-engineering best practices, with optional guidance such as "keep a professional tone". What should they use?

  1. AThe Developer deployment type for the agent's model
  2. BA guardrail with stricter blocking levels
  3. CPrompt Optimizer on the agent's Instructions field
  4. DAn evaluation run that scores the current instructions
Show the answer and why
  • AThe Developer deployment type for the agent's model

    Incorrect

    Deployment types don't change instructions.

  • BA guardrail with stricter blocking levels

    Incorrect

    Guardrails filter harmful content; they don't improve instructions.

  • CPrompt Optimizer on the agent's Instructions field

    Correct

    Prompt Optimizer uses an LLM to restructure and enhance instructions, guided by optional suggestions, then applies the result.

  • DAn evaluation run that scores the current instructions

    Incorrect

    An evaluation measures how the agent performs; it doesn't rewrite the instructions.

Prompt Optimizer rewrites instructions with best practices and explains each change; run an evaluation with your own data afterwards to confirm the new instructions actually help.

Question 8 · choose 1

A prompt includes 300 product records written as full sentences, and it keeps nearing the context limit. The team wants the same facts in fewer tokens. Which prompt technique fits?

  1. ARaise the maximum output tokens
  2. BPresent the records as a compact table
  3. CWrite each record as a longer paragraph
  4. DRepeat each record twice for emphasis
Show the answer and why
  • ARaise the maximum output tokens

    Incorrect

    Output limits don't shrink the prompt.

  • BPresent the records as a compact table

    Correct

    Models understand tabular data well, and tables can be a space-efficient way to include data.

  • CWrite each record as a longer paragraph

    Incorrect

    Longer prose uses more tokens.

  • DRepeat each record twice for emphasis

    Incorrect

    Repetition doubles the token use.

Space efficiency matters even with large context windows: prefer tables, trim boilerplate and remember that token boundaries differ across formats.

Question 9 · choose 1

Users paste long emails into a summarizer's prompt, and sometimes the model treats sentences in the email as instructions. Which prompt change helps the model tell the parts apart?

  1. APut the instructions inside the pasted email text itself
  2. BRemove all formatting from the prompt to keep it short
  3. CRaise the temperature of the summarizer model for each email
  4. DSeparate instructions and pasted text with --- and headings
Show the answer and why
  • APut the instructions inside the pasted email text itself

    Incorrect

    Mixing them makes the confusion worse.

  • BRemove all formatting from the prompt to keep it short

    Incorrect

    Less structure makes the boundary harder to see.

  • CRaise the temperature of the summarizer model for each email

    Incorrect

    Randomness doesn't separate content from instructions.

  • DSeparate instructions and pasted text with --- and headings

    Correct

    Clear syntax, such as separators and uppercase headings, communicates intent and makes outputs easier to parse.

Structure prompts with clear sections and separators; delimiters can also serve as stopping conditions for generation.

Question 10 · choose 1

An internal summarizer for public press releases needs the lowest latency possible. A developer asks whether content filtering affects response time. What does the latency guidance say?

  1. AIt never affects latency, because it runs after the response
  2. BAny developer with Foundry User can remove the filtering
  3. CFiltering adds latency; low-risk cases may request changes
  4. DIt applies only to image models, never to text models
Show the answer and why
  • AIt never affects latency, because it runs after the response

    Incorrect

    Prompts and completions both run through classification models.

  • BAny developer with Foundry User can remove the filtering

    Incorrect

    Turning off output filtering is limited to customers approved for modified guardrails.

  • CFiltering adds latency; low-risk cases may request changes

    Correct

    Content filtering increases safety but also latency; for lower-risk uses, requesting modified filtering policies can be explored.

  • DIt applies only to image models, never to text models

    Incorrect

    The guardrail system applies to text and image content.

Latency tuning weighs model choice, generation size, streaming and filtering. Treat filter changes as a safety decision with approval, not a quick performance tweak.

Question 11 · choose 1

A fact-checking prompt asks a model to verify claims in a paragraph, and it sometimes invents supporting facts. Which prompt engineering technique reduces this by bringing in up-to-date information?

  1. ALower the maximum output tokens for each of its answers
  2. BAsk the model to be more confident in all of its answers
  3. CRemove the paragraph and ask the model to recall it from memory
  4. DLet it issue searches, then paste the results back in
Show the answer and why
  • ALower the maximum output tokens for each of its answers

    Incorrect

    Shorter answers can still be fabricated.

  • BAsk the model to be more confident in all of its answers

    Incorrect

    Confidence doesn't add facts.

  • CRemove the paragraph and ask the model to recall it from memory

    Incorrect

    That relies even more on the model's own parameters.

  • DLet it issue searches, then paste the results back in

    Correct

    Using an affordance such as search mitigates fabricated answers and adds up-to-date information.

Affordances (search, tools) give the model external information instead of relying on its parameters; the agent equivalent is tool calling.

Practise domain 2 →Practise all domains →