Azure AI-102 study materials
Azure AI-102 study resources

Azure AI-102 practice questions

One question at a time. Build your Azure AI-102 understanding.

First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.

Continue in the practice tool above to load more questions, 50 at a time.

Question 1Plan and manage an Azure AI solution

An application running on an Azure virtual machine must call an Azure AI services resource without storing any credentials in code or configuration. Which approach should you use?

  1. Assign a managed identity to the VM and grant it the Cognitive Services User role on the resource. Correct answer.
  2. Enable local authentication and rotate the two resource keys every 30 days.
  3. Store the key in Azure Key Vault and embed a vault client secret in the application settings.
  4. Copy the resource key into the VM's environment variables during provisioning.

Explanation

A managed identity lets the VM obtain Microsoft Entra ID tokens for the resource, so no secret is stored in code or configuration. Granting the identity a role such as Cognitive Services User authorizes data-plane calls to the resource.

Question 2Plan and manage an Azure AI solution

Which pricing tier of an Azure AI services resource is intended for limited trial and evaluation workloads and includes a monthly free transaction quota?

  1. Standard S0
  2. Free F0 Correct answer.
  3. Commitment C1
  4. Basic B1

Explanation

The F0 tier provides a limited monthly free transaction quota and is designed for trials and evaluation. Production workloads normally use S0 pay-as-you-go pricing or a commitment tier.

Question 3Plan and manage an Azure AI solution

You plan to call Vision, Language, and Speech capabilities from a single endpoint using one set of keys. What should you create?

  1. A multi-service AI services resource Correct answer.
  2. An Azure API Management gateway
  3. A single-service Vision resource
  4. An Azure Machine Learning workspace with a compute cluster

Explanation

A multi-service Azure AI services resource exposes multiple prebuilt APIs through one endpoint and one set of keys. Single-service resources each provide only their own endpoint and keys.

Question 4Plan and manage an Azure AI solution

A key for a production Azure AI services resource is suspected to have been leaked. Which action should you take?

  1. Disable local authentication on the resource.
  2. Delete the resource and recreate it in the same region.
  3. Rotate the endpoint hostname of the resource.
  4. Regenerate the compromised key and update dependent apps. Correct answer.

Explanation

Regenerating the compromised key invalidates it immediately while the second key keeps clients running during the update. Both keys should eventually be rotated so no leaked material remains valid.

Question 5Plan and manage an Azure AI solution

Your organization requires that data processed by Azure AI services stays within Australia. What determines where the data is processed?

  1. The region where the client application is running.
  2. The country specified in the subscription's billing profile.
  3. The location of the nearest Azure Front Door POP.
  4. The Azure region that hosts the Azure AI services resource. Correct answer.

Explanation

Azure AI services process requests in the Azure region where the resource is created, which determines the data-residency geography. Selecting a resource region inside the required geography satisfies the requirement.

Question 6Plan and manage an Azure AI solution

You need the request logs of an Azure AI services resource to be queryable in a Log Analytics workspace. Where do you configure this?

  1. In the Log Analytics workspace data collection rules.
  2. In the Diagnostic settings page of the resource. Correct answer.
  3. In the Access control (IAM) blade of the resource.
  4. In the Azure Policy definitions assigned to the subscription.

Explanation

Diagnostic settings on the resource select which log categories to collect and which destinations, such as Log Analytics, a storage account, or an event hub, receive them.

Question 7Plan and manage an Azure AI solution

You must run Azure AI service inferencing inside your own datacenter so that document content never leaves the premises, while usage continues to be billed through Azure. Which deployment option fits?

  1. Azure Front Door caching
  2. Private endpoint deployment
  3. Connected containers Correct answer.
  4. Disconnected containers

Explanation

Connected containers run locally and send only metering information to Azure, so inference data stays on-premises while billing continues. Disconnected containers run with no Azure connectivity at all.

Question 8Plan and manage an Azure AI solution

An Azure AI services resource must be reachable only from inside a virtual network and must not be callable from the public internet. What should you configure?

  1. Enable a service endpoint on the resource's subnet.
  2. Create a private endpoint and disable public access. Correct answer.
  3. Enable public network access and add an IP firewall rule.
  4. Configure CORS on the resource endpoint.

Explanation

A private endpoint assigns a private IP address for the resource inside your subnet, and disabling public network access blocks internet clients. Clients then resolve the resource through the linked private DNS zone.

Question 9Plan and manage an Azure AI solution

Several teams build generative AI applications and need isolated work areas but shared networking, connections, and security settings. Which structure should you plan?

  1. One multi-service AI services resource per team with shared keys
  2. A hub that contains one project per team Correct answer.
  3. A separate subscription for each team
  4. One Azure Machine Learning workspace per team

Explanation

In Azure AI Foundry a hub supplies shared networking, security, connections, and compute, while projects partition work per team. This centralizes governance while keeping each team's assets separate.

Question 10Plan and manage an Azure AI solution

During peak hours an application receives HTTP 429 responses from an Azure AI services resource. What is the recommended handling?

  1. Retry with exponential backoff and review quota. Correct answer.
  2. Generate additional keys for the resource.
  3. Disable diagnostic logging to reduce load.
  4. Recreate the resource in a different region.

Explanation

HTTP 429 indicates the request rate exceeded the allowed quota, so callers should retry with exponential backoff and jitter. If the load is sustained, a quota increase should be requested for the resource.

Question 11Plan and manage an Azure AI solution

A company generates a large, predictable monthly volume of transactions on a multi-service Azure AI services resource and wants the lowest per-unit price. Which pricing option should they evaluate?

  1. Standard S0 pay-as-you-go
  2. Multiple S0 resources, one per region
  3. Free F0 tier
  4. Commitment tier pricing Correct answer.

Explanation

Commitment tiers trade a monthly committed transaction volume for a discounted per-unit rate, which fits high and predictable usage. S0 bills list price per transaction and F0 is a small free quota.

Question 12Plan and manage an Azure AI solution

Which configuration provides customer-managed keys for data at rest in an Azure AI services resource?

  1. Enable Azure Disk Encryption on the client virtual machines.
  2. Enforce TLS 1.2 on the resource endpoint.
  3. Assign a system-assigned identity to the client application.
  4. Use a Key Vault key associated with the resource. Correct answer.

Explanation

Azure AI services support customer-managed keys by associating a key from Azure Key Vault with the resource and granting the resource's managed identity access to the vault. The key then wraps the encryption of stored data.

Question 13Plan and manage an Azure AI solution

You must ensure that Azure AI services resources in a subscription can be created only in approved Azure regions. Which service should you use?

  1. Microsoft Defender for Cloud
  2. Azure Cost Management
  3. Azure Monitor
  4. Azure Policy Correct answer.

Explanation

Azure Policy can deny or audit resource creation based on allowed locations and applies at management group, subscription, or resource group scope. This makes it the enforcement tool for regional restrictions.

Question 14Plan and manage an Azure AI solution

Finance needs Azure AI services costs attributed to individual departments. What is the simplest way to enable this in cost analysis?

  1. Tag each resource with its department and group costs by tag. Correct answer.
  2. Rename each resource so that the department name is part of the resource name.
  3. Create a separate subscription for every department and consolidate the invoices.
  4. Export the monthly invoice to a spreadsheet.

Explanation

Tags flow into cost records, so grouping cost analysis by the department tag attributes spend to each department. Azure Policy can then require the tag on all new resources.

Question 15Plan and manage an Azure AI solution

You need repeatable, version-controlled deployment of Azure AI services resources across development, test, and production. Which approach should you use?

  1. Export the resource keys and store them in a shared team wiki.
  2. Run a one-time PowerShell script and clone the subscription.
  3. Create resources manually in the portal using a documented checklist.
  4. Deploy Bicep templates from a Git-based pipeline. Correct answer.

Explanation

Infrastructure as code stored in source control gives repeatable, reviewable, and versioned deployments to every environment. Pipelines apply the same template with environment-specific parameters.

Question 16Plan and manage an Azure AI solution

You must allow calls to an Azure AI services resource only from a specific virtual network subnet, and you are not permitted to use a private endpoint. What should you configure?

  1. A virtual network rule for the subnet with the service endpoint enabled Correct answer.
  2. A service tag rule for AzureCloud in the firewall
  3. A private endpoint created in the subnet
  4. An IP firewall rule for the subnet's outbound address range

Explanation

Virtual network rules restrict access to traffic originating from named subnets, and the subnet must enable the Microsoft.CognitiveServices service endpoint so traffic uses the Azure backbone. This limits callers without creating a private IP.

Question 17Plan and manage an Azure AI solution

A model deployment fails because the subscription's capacity for that model in the chosen region is exhausted. Which action addresses the failure?

  1. Change the pricing tier from S0 to F0.
  2. Request a quota increase or use another region. Correct answer.
  3. Enable diagnostic logging on the resource.
  4. Regenerate the resource's primary key.

Explanation

Quota limits apply per subscription, model, and region, so a quota increase or a deployment in a region with capacity resolves the failure. Neither action requires rebuilding the application.

Question 18Plan and manage an Azure AI solution

Users in Europe and Asia report high latency when calling a single Azure AI services resource hosted in West Europe. Which design change should you make?

  1. Move the resource to the free F0 tier.
  2. Deploy multi-region resources and route to the nearest. Correct answer.
  3. Enable customer-managed keys on the resource.
  4. Increase the transaction quota of the resource.

Explanation

Deploying the service in multiple regions and routing each user to the closest endpoint reduces the network round-trip time. Quota, encryption, and pricing tier do not affect geographic latency.

Question 19Plan and manage an Azure AI solution

You must prevent accidental deletion of a production Azure AI services resource while still allowing keys to be regenerated. What should you apply?

  1. A CanNotDelete lock on the resource Correct answer.
  2. A role assignment of Reader for all users
  3. Diagnostic settings that log delete operations
  4. A read-only lock on the resource

Explanation

A CanNotDelete lock blocks deletion while still permitting management operations such as key regeneration. A read-only lock would also block the updates you need.

Question 20Plan and manage an Azure AI solution

An application calls an Azure OpenAI model at a steady, high volume and requires consistent low latency with guaranteed capacity. Which deployment type is most appropriate?

  1. Free tier deployment
  2. Provisioned throughput deployment Correct answer.
  3. Pay-as-you-go standard deployment
  4. Batch deployment with a 24-hour turnaround

Explanation

Provisioned throughput reserves model capacity for a fixed cost, which provides more predictable latency under sustained load. Standard deployments are billed per token and can be throttled when demand exceeds the quota.

Question 21Plan and manage an Azure AI solution

You must block harmful categories of generated content at the model deployment level in Azure AI Foundry. How should you configure this?

  1. By enabling diagnostic logging on the resource
  2. By adding a network security group rule to the resource's subnet
  3. By assigning an Azure Policy definition to the subscription
  4. By assigning a content filter policy to the model deployment Correct answer.

Explanation

Content filters are defined as policies and attached to model deployments so that prompts and completions are evaluated against harm categories. The policy can be customized and applied per deployment.

Question 22Plan and manage an Azure AI solution

You need to be notified when an Azure AI services resource begins returning a rising number of errors. What should you configure?

  1. A stricter content filter policy
  2. An Azure Monitor alert rule on error metrics Correct answer.
  3. A higher commitment tier
  4. A CanNotDelete resource lock

Explanation

Azure Monitor alert rules evaluate metrics or log queries and trigger notifications when a threshold is crossed. This is the standard mechanism for detecting a rising error rate.

Question 23Plan and manage an Azure AI solution

A remote site has no internet connectivity and must run Azure AI text analytics on local documents indefinitely. Which combination is required?

  1. An Azure Arc-enabled cluster with public egress enabled
  2. Only the container image and a valid API key on the host
  3. Internet access to the billing endpoint and an F0 key
  4. A disconnected image, a commitment tier, and an activation file Correct answer.

Explanation

Disconnected containers run without any connection to Azure, so you must purchase a commitment tier and download an activation file while connected before running offline. Billing is then reconciled through that commitment.

Question 24Plan and manage an Azure AI solution

A data scientist must be able to call an Azure AI services resource but must not be able to change its configuration or access control. Which role assignment meets the requirement?

  1. Owner at the subscription scope
  2. Reader on the resource
  3. Cognitive Services User on the resource Correct answer.
  4. Contributor on the resource group

Explanation

Cognitive Services User grants data-plane access to call the service while excluding management of the resource. Contributor and Owner would allow configuration changes, and Reader does not permit data-plane calls.

Question 25Plan and manage an Azure AI solution

A solution must meet three requirements: processing must remain in the EU, applications must authenticate without keys, and every request must be auditable. Which combination satisfies all three?

  1. A multi-region resource, shared keys, and diagnostic settings to a Log Analytics workspace in another region
  2. An EU-region resource, managed identity with the Cognitive Services User role, and diagnostic logs to Log Analytics Correct answer.
  3. An EU-region resource, key authentication with keys stored in Key Vault, and activity log export to a storage account in another region
  4. A resource in the billing country's region, managed identity, and Azure Monitor metrics only

Explanation

Creating the resource in an EU region keeps processing in the EU, managed identity with a data-plane role removes stored keys, and diagnostic logs sent to Log Analytics provide the request-level audit trail.

Question 26Plan and manage an Azure AI solution

A subscription already contains a free-tier (F0) Azure AI Services resource of kind TextAnalytics. An engineer attempts to create a second F0 resource of the same kind in the same subscription. What is the outcome?

  1. The request fails because only one free-tier resource of a given kind is permitted per subscription. Correct answer.
  2. The second resource is created automatically at the standard tier.
  3. The second resource is created but remains in a disabled state until the first is deleted.
  4. The second resource is created and shares a pooled quota with the first resource.

Explanation

The F0 tier is limited to one free resource per subscription for each kind of Azure AI service. A second F0 resource of the same kind is rejected; you would need to use the S0 tier instead. Free-tier quotas are also capped on call rate and volume.

Question 27Plan and manage an Azure AI solution

Before provisioning any resources, you must estimate the monthly cost of a planned Azure AI Vision solution based on expected transaction volume. Which tool should you use?

  1. The Total Cost of Ownership (TCO) calculator
  2. Cost analysis in Microsoft Cost Management
  3. The Azure Pricing Calculator Correct answer.
  4. Azure Advisor cost recommendations

Explanation

The Azure Pricing Calculator lets you model a not-yet-deployed workload by selecting services, tiers, and estimated volumes to produce a forward-looking cost estimate. Cost Management tools report on resources that already exist and are billed.

Question 28Plan and manage an Azure AI solution

Applications must authenticate to an Azure AI Services resource by presenting Microsoft Entra ID access tokens instead of account keys. What must the resource be configured with?

  1. A custom subdomain name assigned to the resource Correct answer.
  2. A system-assigned managed identity enabled on the Azure AI Services resource
  3. A second account key stored in Azure Key Vault
  4. An App Service Environment deployed in the same region as the resource

Explanation

Token-based authentication requires a custom subdomain endpoint, because the token audience and the regional endpoint format only work when the resource has a unique subdomain name. Without it, callers can only use key-based authentication against the regional endpoint.

Question 29Plan and manage an Azure AI solution

An application authenticates to an Azure AI Services resource with Key1. You must rotate the keys without causing an outage. What should you do first?

  1. Regenerate Key2, deploy the application using Key2, and then regenerate Key1. Correct answer.
  2. Regenerate both keys at the same time and restart all application instances immediately.
  3. Regenerate Key1 and wait for the application to pick up the new value from configuration.
  4. Create a second Azure AI Services resource and migrate the application to it.

Explanation

Because each resource has two keys, you rotate in a staggered sequence: refresh the unused key, move clients onto it, then refresh the key that is no longer in use. This keeps a valid credential available at every step.

Question 30Plan and manage an Azure AI solution

A nightly job must process a large backlog of documents with an Azure OpenAI model. Completion within a few hours is acceptable, and cost must be minimized. Which deployment option should you choose?

  1. A global batch deployment Correct answer.
  2. A data zone standard deployment
  3. A standard deployment
  4. A provisioned throughput deployment

Explanation

Batch deployments are designed for high-volume, latency-tolerant work and are offered at a discounted price compared with online deployments. Because the job does not need immediate responses, the asynchronous batch model fits both the workload and the cost goal.

Question 31Plan and manage an Azure AI solution

You must review per-minute call volume and response latency for an Azure AI Services resource over the past week, and you want to avoid authoring queries. Which capability should you use?

  1. Metrics explorer in Azure Monitor Correct answer.
  2. Diagnostic settings that send resource logs to a storage account
  3. Availability tests in Application Insights
  4. Performance recommendations in Azure Advisor

Explanation

Azure AI Services resources emit platform metrics such as call counts and latency, which Metrics explorer charts over selectable time ranges without any query language. Logs require a workspace and query authoring, while Advisor provides recommendations rather than raw telemetry.

Question 32Plan and manage an Azure AI solution

A platform team must create, configure, and regenerate keys for Azure AI Services resources, but must not be able to grant access to other users. Which built-in role should you assign?

  1. Owner
  2. Cognitive Services OpenAI User
  3. Cognitive Services Contributor Correct answer.
  4. Cognitive Services User

Explanation

Cognitive Services Contributor grants full management-plane control over Azure AI Services resources, including creating them and managing their keys, without the ability to assign roles. Role assignment requires Owner or User Access Administrator.

Question 33Plan and manage an Azure AI solution

Security mandates that every request to an Azure AI Services resource be authenticated with Microsoft Entra ID, and that any request presenting an account key be rejected. What should you configure on the resource?

  1. Enable a private endpoint and turn off public network access.
  2. Assign the Cognitive Services User role to every calling identity.
  3. Delete both account keys from the resource in the Azure portal.
  4. Set the disableLocalAuth property to true on the resource. Correct answer.

Explanation

Disabling local authentication makes the resource refuse key-based credentials and accept only Microsoft Entra ID tokens, which is the enforcement point on the resource itself. Key-based auth cannot be re-enabled by copying a key because no key path is honored.

Question 34Plan and manage an Azure AI solution

You create a private endpoint for an Azure AI Services resource named myai. Client virtual machines must resolve myai.cognitiveservices.azure.com to the private IP address. Which private DNS zone should you link to the virtual network?

  1. privatelink.cognitiveservices.azure.com Correct answer.
  2. privatelink.openai.azure.com
  3. privatelink.api.azureml.ms
  4. privatelink.azurewebsites.net

Explanation

Azure AI Services private endpoints use the group ID account and map the cognitiveservices.azure.com namespace, so an A record in privatelink.cognitiveservices.azure.com is what overrides public resolution. Linking that zone to the virtual network makes the custom subdomain resolve to the private endpoint address.

Question 35Implement generative AI solutions

Which Azure OpenAI model is designed to generate images from natural language text prompts?

  1. GPT-4o
  2. Whisper
  3. DALL-E 3 Correct answer.
  4. text-embedding-3-large

Explanation

DALL-E is the Azure OpenAI image generation model family, taking a text prompt and returning generated images. GPT-4o handles text and image input for chat, Whisper transcribes audio, and embedding models output vectors.

Question 36Implement generative AI solutions

What is the primary purpose of a system message in an Azure OpenAI chat completion request?

  1. To define the assistant's persona and rules Correct answer.
  2. To enable streaming of partial responses
  3. To cap the number of tokens billed per call
  4. To authenticate the request to the resource endpoint

Explanation

The system message is prepended to the conversation and steers the model's tone, role, format, and constraints for the whole exchange. Authentication and billing are handled by request headers and deployment settings, not message content.

Question 37Implement generative AI solutions

Which parameter setting makes model output more varied and creative?

  1. A lower top_p value
  2. A higher temperature value Correct answer.
  3. A higher max_tokens value
  4. A lower temperature value

Explanation

Temperature scales the randomness of token sampling; raising it flattens the probability distribution so less likely tokens can be chosen. The other settings either shorten output or narrow the sampling pool, which reduces variety.

Question 38Implement generative AI solutions

Which request parameter limits the maximum number of tokens the model generates in its response?

  1. top_p
  2. max_tokens Correct answer.
  3. stop
  4. frequency_penalty

Explanation

max_tokens caps the completion tokens the service will produce for the call. The stop parameter ends generation when a string appears, while top_p and frequency_penalty influence token selection rather than length.

Question 39Implement generative AI solutions

What does an embedding model such as text-embedding-3-small produce for a piece of text?

  1. A set of likely follow-up questions
  2. A compressed summary in plain language
  3. A sentiment label with a confidence score
  4. A numeric vector representing semantic meaning Correct answer.

Explanation

Embedding models map text into a high-dimensional vector space where semantically similar text lands close together, enabling vector search, clustering, and classification. They do not generate prose, questions, or classification labels directly.

Question 40Implement generative AI solutions

Azure OpenAI content filters evaluate prompts and completions against which four harm categories?

  1. Profanity, malware, phishing, and piracy
  2. Hate, sexual, violence, and self-harm Correct answer.
  3. Privacy, copyright, medical, and legal
  4. Bias, toxicity, plagiarism, and spam

Explanation

The default content filtering system classifies text into hate, sexual, violence, and self-harm categories at multiple severity levels and can block or annotate content. The other listed categories are not part of the standard filter taxonomy.

Question 41Implement generative AI solutions

Before you can send chat completion requests to a model in an Azure OpenAI resource, what must you create?

  1. A named model deployment Correct answer.
  2. A virtual network peering
  3. A Log Analytics workspace
  4. A storage account container

Explanation

Requests address a deployment name in the URL, so the model must first be deployed to the resource even though the deployment name can differ from the underlying model name. Storage, networking, and diagnostics are optional supporting resources.

Question 42Implement generative AI solutions

Which Azure OpenAI capability converts spoken audio files into written text?

  1. Function calling
  2. Whisper transcription Correct answer.
  3. DALL-E image generation
  4. Text embedding

Explanation

Whisper is the speech-to-text model family in Azure OpenAI and accepts audio input to return transcripts. The other capabilities produce images, vectors, or structured function calls, not transcripts.

Question 43Implement generative AI solutions

You want answers grounded in your company's internal documents without retraining the model. Which approach should you use?

  1. Raise the temperature and increase max_tokens
  2. Fine-tune the model on the documents
  3. Deploy a larger model with provisioned throughput
  4. Add retrieved document chunks to the prompt Correct answer.

Explanation

Retrieval-augmented generation fetches relevant chunks from a search index and injects them into the prompt, so the model answers from current source content. Fine-tuning teaches behavior and format far better than it teaches new, changing facts.

Question 44Implement generative AI solutions

Why do RAG pipelines typically split documents into overlapping chunks?

  1. To lower the cost of the embedding deployment
  2. To reduce the number of embedding dimensions stored
  3. To guarantee the model never sees duplicate text
  4. To keep context intact across chunk boundaries Correct answer.

Explanation

Overlap ensures that sentences spanning a split point appear whole in at least one chunk, preserving meaning for retrieval and grounding. It does not change vector dimensions, deduplicate content, or reduce deployment cost.

Question 45Implement generative AI solutions

A team wants the model to consistently follow a proprietary response format and tone. Which technique is most appropriate?

  1. Fine-tuning with example conversations Correct answer.
  2. Hosting the model in a private virtual network
  3. Increasing top_p to its maximum value
  4. Adding a keyword filter to the search index

Explanation

Fine-tuning adjusts model weights using example conversations, which is effective for teaching style, format, and task behavior. It is not the preferred mechanism for injecting changing factual knowledge.

Question 46Implement generative AI solutions

How does function calling work in an Azure OpenAI chat completion?

  1. The service creates an API Management endpoint automatically
  2. The model compiles the function into a deployment artifact
  3. The model returns JSON naming the function and arguments Correct answer.
  4. The model executes the function in the Azure sandbox and returns its output

Explanation

You describe tools in the request, and the model responds with a tool call containing the function name and JSON arguments. Your application executes the function and sends the result back as a tool message.

Question 47Implement generative AI solutions

What does the top_p (nucleus sampling) parameter control?

  1. How many completions the service returns per call
  2. The cumulative probability mass used for token sampling Correct answer.
  3. The number of retries after a throttled request
  4. The penalty applied to tokens already used in the text

Explanation

Nucleus sampling keeps only the smallest set of tokens whose probabilities sum to top_p, then samples from that set. Lower values narrow the pool and make output more focused.

Question 48Implement generative AI solutions

Which deployment option provides reserved model capacity with predictable latency for a steady, high-volume workload?

  1. Serverless pay-per-token endpoint
  2. Provisioned (reserved capacity) Correct answer.
  3. Global batch deployment
  4. Standard (pay-as-you-go) deployment

Explanation

Provisioned throughput reserves model processing capacity measured in throughput units, giving steadier latency for sustained traffic. Standard deployments share capacity and are billed per token.

Question 49Implement generative AI solutions

Which practice best reduces the risk of a prompt injection attack in a chat application?

  1. Separate system instructions from untrusted user input Correct answer.
  2. Concatenate retrieved documents with user instructions
  3. Log full prompts and display them to all users
  4. Allow the model to call any REST API the user names

Explanation

Prompt injection succeeds when untrusted text is treated as instructions, so the system message should hold the rules while user and document content is framed as data to be processed. Additional layers such as content filtering and output validation further reduce risk.

Question 50Implement generative AI solutions

How do you enable incremental token streaming in an Azure OpenAI chat completion call?

  1. Set the stream parameter to true Correct answer.
  2. Set n to a value greater than one
  3. Set max_tokens to zero
  4. Send the request over HTTP GET instead of POST

Explanation

Setting stream to true returns server-sent events that deliver partial content deltas as tokens are generated. The other settings affect length, candidate count, or transport but do not produce incremental output.