Azure-AI_Foundry

Module 4: Knowledge Check

Test your understanding of prompt engineering techniques, the Playground, model parameters, and Prompt Flow with these 15 scenario-based questions.


Questions

Question 1

You are building a customer support classifier that must always output exactly one of five categories. Which parameter configuration is most appropriate?

A) temperature: 1.0, top_p: 0.5 B) temperature: 0.0, top_p: 1.0 C) temperature: 0.7, top_p: 0.95 D) temperature: 1.5, top_p: 0.8


Question 2

A developer writes the prompt: “Summarize this.” The model produces inconsistent, overly long summaries. What is the best improvement?

A) Increase temperature to 1.5 for better creativity B) Add specific instructions: length, format, focus areas, and audience C) Switch to a larger model D) Set max_tokens to 10 to force brevity


Question 3

You need to extract structured product data from free-text descriptions and ensure the output is always valid JSON. Which approach is most reliable?

A) Ask the model to “please output JSON” in the user message B) Use response_format: {"type": "json_object"} and mention JSON in the prompt C) Parse the text response and hope it is valid JSON D) Use few-shot examples only — no response_format setting


Question 4

A chatbot for a legal firm sometimes generates legal advice that contradicts the firm’s policies. Which system prompt technique best addresses this?

A) Increase temperature to explore more response options B) Add explicit constraints: “Only reference information from the provided policy documents. If a question is not covered, say ‘Please consult your attorney.’” C) Remove the system prompt so the model is unconstrained D) Use a smaller model that knows less


Question 5

You want the model to solve a multi-step math problem correctly. Which prompting technique is most effective?

A) Zero-shot: “Solve this problem.” B) Chain-of-thought: “Think step by step and show your reasoning.” C) Few-shot with only final answers D) Set temperature to 2.0 for maximum exploration


Question 6

In the Azure AI Foundry Playground, you have configured a system prompt, set temperature to 0.3, and tested 10 queries successfully. What is the fastest way to use this configuration in your Python application?

A) Retype all the settings manually in code B) Screenshot the Playground and reference it C) Click “View Code” to export the configuration as Python code D) Copy just the system prompt and guess the other settings


Question 7

A content generation application produces repetitive text — the same phrases appear multiple times in long outputs. Which parameter adjustment will help?

A) Increase max_tokens B) Increase frequency_penalty to 0.5–0.8 C) Set temperature to 0.0 D) Decrease top_p to 0.1


Question 8

You are building a flow that: (1) classifies user intent, (2) retrieves relevant documents, (3) generates a response using those documents. Which Prompt Flow type is most appropriate?

A) Evaluation Flow B) Standard Flow C) Chat Flow D) Standard Flow cannot handle multi-step logic


Question 9

A developer uses few-shot prompting with 3 examples for a data extraction task. The model follows the format for inputs similar to the examples but fails on edge cases. What should they do?

A) Remove all examples — zero-shot is always better B) Add more diverse examples that cover edge cases and unusual formats C) Switch to a different model D) Increase temperature to handle diverse inputs


Question 10

You want to let the model call external APIs (weather, database lookups) when needed during a conversation. What is the recommended approach?

A) Include API URLs in the system prompt and ask the model to call them B) Use the tools parameter with function calling definitions C) Tell the model to output curl commands and execute them yourself D) Use a separate API gateway — LLMs cannot call APIs


Question 11

A Prompt Flow has 4 nodes. One LLM node is taking 8 seconds, making the total flow too slow. How can you optimize it?

A) Switch all nodes to Python — never use LLM nodes B) Use a faster/smaller model for that LLM node if quality permits, or cache repeated calls C) Remove the slow node entirely D) Increase the VM size for the Prompt Flow runtime


Question 12

Your evaluation flow scores your chatbot at 0.85 groundedness but 0.45 relevance. What does this mean, and what should you fix?

A) The model’s responses are factually supported by context, but it is not addressing the user’s actual question — improve the system prompt to focus on answering the user’s query B) The model is not using the provided context — increase the context window C) Both scores are low — switch to a better model D) Relevance cannot be improved through prompt changes


Question 13

When should you adjust top_p instead of temperature?

A) Always — top_p is superior to temperature B) Rarely — adjust temperature first; only change top_p if you need to strictly limit the vocabulary of candidate tokens C) When you want more creative outputs D) top_p and temperature do the same thing — it does not matter


Question 14

A developer wants to use DALL-E 3 to generate product mockups. The generated images are too generic. Which approach will improve results?

A) Generate more images and pick the best one B) Write detailed prompts specifying subject, style, composition, lighting, and context C) Use a lower quality setting for faster iteration D) Switch to Whisper for image generation


Question 15

You have a complex Prompt Flow in production. A new model version is available. How should you validate the upgrade?

A) Update the production flow immediately and monitor for issues B) Run the evaluation flow against the new model with your test dataset, compare metrics to the current model, then upgrade if metrics are equal or better C) Read the model release notes and upgrade if the benchmarks improved D) Model upgrades are always backwards-compatible — no testing needed


Answers

Answer 1: B) temperature: 0.0, top_p: 1.0

For deterministic classification tasks where the output must be exactly one of a fixed set of categories, use temperature 0.0 for maximum consistency. High temperature introduces unwanted randomness in classification.

Answer 2: B) Add specific instructions: length, format, focus areas, and audience

Vague prompts produce vague outputs. A better prompt would specify: “Summarize in 2-3 bullet points, focusing on the main issue and resolution, for a customer support manager.” Cutting max_tokens too aggressively can truncate mid-sentence.

Answer 3: B) Use response_format: {"type": "json_object"} and mention JSON in the prompt

JSON mode guarantees syntactically valid JSON output. However, the model needs the word “JSON” in the prompt to engage this behavior reliably. For strict schema enforcement, use json_schema response format.

Answer 4: B) Add explicit constraints in the system prompt

System prompt constraints like “Only reference provided policy documents” and fallback behavior (“say ‘Please consult your attorney’”) are the primary mechanism for keeping the model within bounds. Reducing temperature can help but is not sufficient alone.

Answer 5: B) Chain-of-thought: “Think step by step and show your reasoning.”

Chain-of-thought prompting significantly improves accuracy on math and multi-step reasoning tasks by forcing the model to work through intermediate steps rather than jumping to a final answer.

Answer 6: C) Click “View Code” to export as Python code

The “View Code” button in the Playground generates ready-to-use code with all your settings (system prompt, parameters, model selection) in Python, C#, JavaScript, or curl format.

Answer 7: B) Increase frequency_penalty to 0.5–0.8

Frequency penalty reduces the probability of tokens proportional to how often they have appeared, directly addressing repetitive phrasing. Setting temperature to 0 would make repetition worse, not better.

Answer 8: C) Chat Flow

A Chat Flow is optimized for conversational scenarios with multi-step logic and built-in conversation history management. Standard Flow would also work, but Chat Flow provides the conversation primitives out of the box.

Answer 9: B) Add more diverse examples covering edge cases

Few-shot examples define the model’s understanding of the task. If the model fails on edge cases, the examples are not representative enough. Adding diverse examples (including unusual inputs and formats) improves robustness.

Answer 10: B) Use the tools parameter with function calling

Function calling is the built-in, reliable mechanism for enabling the model to invoke external tools. The model outputs structured function call arguments, and your code executes the actual API call and returns the result.

Answer 11: B) Use a faster/smaller model or cache repeated calls

Replacing an LLM node with a smaller, faster model (e.g., GPT-4o-mini instead of GPT-4o) can dramatically reduce latency if the task quality permits. Caching identical inputs avoids redundant LLM calls entirely.

Answer 12: A) Responses are grounded but not relevant — fix the prompt

High groundedness (0.85) means the model is citing information that exists in the context. Low relevance (0.45) means it is not answering the user’s actual question. The fix is to adjust the system prompt to prioritize addressing the user’s query directly.

Answer 13: B) Rarely — adjust temperature first

Temperature is the primary control for randomness. Top_p is a secondary control that limits the candidate token vocabulary. Adjusting both simultaneously is discouraged. Change temperature first, and only modify top_p for specific vocabulary control needs.

Answer 14: B) Write detailed prompts with specifics

DALL-E 3 produces better results with specific prompts that include subject details, style (photorealistic, illustration, etc.), composition, lighting, background, and any other relevant visual attributes. Whisper is a speech-to-text model, not an image generator.

Answer 15: B) Run evaluation flows with test datasets, compare metrics, then upgrade

Model upgrades should be treated like code deployments — test before production. Run your existing evaluation flow against the new model version with the same test dataset and compare metrics (groundedness, relevance, coherence). Only upgrade if metrics are maintained or improved.