All Microsoft exams
Free AI-200 practice test: 30 questions with answers
30 original questions for Developing AI Cloud Solutions on Azure, drawn from every topic area. Answer each one to see whether you got it right and why. No sign-up.
- Free questions
- 30
- Full bank
- 100 questions
All 30 AI-200 questions with answers
The same questions as the test above, grouped by exam topic. Open any question to see the answer and explanation.
Develop AI solutions by using Azure data management services (8 questions)
Question 1
A RAG application stores product documents in Azure Cosmos DB for NoSQL and must find the items most similar to a query embedding. Which capability should the team enable on the container?
- AA vector index with a vector embedding policy on the embedding path
- BA hash-partitioned unique key constraint on the id path
- CMulti-region writes with session consistency enabled in Azure
- DA change feed lease container storing continuation tokens
Show answer and explanationHide answer
Correct answer: AVector search in Cosmos DB for NoSQL requires a vector embedding policy that declares the path, dimensions, and distance function, plus a matching vector index. Multi-region writes affect availability, not similarity search, and the change feed only streams changes.
Question 2
A Cosmos DB workload is read-heavy but tolerates reads that may lag slightly behind writes, and the team wants to lower RU cost per read without losing ordering guarantees within a single session. Which consistency level best fits?
- AStrong
- BBounded staleness
- CSession
- DEventual
Show answer and explanationHide answer
Correct answer: CSession consistency gives read-your-writes and monotonic reads within a client session at a lower cost than strong consistency. Eventual has no ordering guarantees within a session, and strong consistency is the most expensive option for reads.
Question 3
A service must process every new or updated item in a Cosmos DB container to refresh a search index, and it must resume from where it stopped after a crash. Which feature should it use?
- AMulti-region replication with automatic failover enabled
- BAnalytical store with a nightly export to blob storage
- CA stored procedure triggered on each write request
- DChange feed processor with a lease container
Show answer and explanationHide answer
Correct answer: DThe change feed processor reads changes in order and stores its progress in a lease container, so it can resume after a restart. Analytical store is aimed at large-scale analytics, and a trigger inside the database does not give a durable resumable consumer.
Question 4
An Azure Database for PostgreSQL flexible server holds 40 million embeddings in a pgvector column and similarity queries are slow. The team wants to speed up the nearest-neighbour search. What is the most appropriate step?
- AConvert the embedding column to a text column and cast back to vector in each similarity query
- BCreate an HNSW or IVFFlat index on the vector column that matches the distance operator used in queries
- CDisable autovacuum on the table to free up CPU for the similarity queries during peak hours
- DReplace the table with a JSON column that stores embeddings as arrays and rely on a sequential scan
Show answer and explanationHide answer
Correct answer: Bpgvector supports approximate nearest-neighbour indexes such as HNSW and IVFFlat, and the index must use the same distance operator as the query for it to be used. Converting to text or JSON removes the vector operators, and disabling autovacuum leads to bloat rather than faster search.
Question 5
A chat service opens a new PostgreSQL connection for every request and the database spends much of its time on connection setup. Which two changes best reduce that overhead? (Choose two.)
- AUse a connection pooler such as PgBouncer so server connections are reused
- BIncrease the database max_connections to 5000
- CKeep a long-lived connection pool inside the application process
- DSet statement_timeout to zero
- ERaise the vector index dimension count
Show answer and explanationHide answer
Correct answer: A, CPooling reuses established server connections, both at an external pooler and in an application-side pool, so the setup cost is paid once rather than per request. Raising max_connections adds memory pressure without removing setup cost, and the timeout and dimension settings do not affect connection establishment.
Question 6
An AI assistant caches the answers to frequently asked questions and must invalidate a cached answer when its source document changes. Which Azure service and pattern fits this requirement best?
- AAzure Front Door origin groups with health probes that route requests to healthy origins
- BAzure Managed Redis with explicit key deletion or short expiration when the source is updated
- CAzure Blob Storage lifecycle rules that tier or delete blobs after a set number of days since creation
- DAzure Files snapshots of the file share taken on a schedule with retention and restore through the portal
Show answer and explanationHide answer
Correct answer: BAzure Managed Redis supports key expiration and explicit deletion, which covers both time-based and event-driven invalidation of cached answers. Blob lifecycle rules manage object tiers and deletion, and Front Door and Azure Files do not provide application-level cache invalidation.
Question 7
A developer wants semantic caching in Azure Managed Redis so that a new question close in meaning to a cached one returns the stored answer. Which capability is required?
- AKeyspace notifications that publish key expiry events
- BVector indexing with a similarity search query
- CRedis Pub/Sub channels that push events to listeners
- DLua scripting for exact string matching
Show answer and explanationHide answer
Correct answer: BSimilarity lookup needs vector fields with an index that supports nearest-neighbour search, so the application can find cached embeddings close to the new query. Pub/Sub and keyspace notifications deliver messages about changes and do not search by similarity.
Question 8
Which two practices reduce Request Unit consumption for point reads and queries in Azure Cosmos DB for NoSQL? (Choose two.)
- AUsing point reads with the item id and partition key where possible
- BRemoving the partition key from every document
- CExcluding paths that are never filtered on from the indexing policy
- DRunning cross-partition queries for every lookup
- ESetting the throughput to the maximum allowed value by default
Show answer and explanationHide answer
Correct answer: A, CPoint reads are the cheapest operation in Cosmos DB because they go straight to one item, and an indexing policy that excludes unused paths lowers the write and storage cost of index maintenance. Cross-partition queries fan out and cost more, and removing the partition key breaks scalability.
Secure, monitor, and troubleshoot Azure solutions (8 questions)
Question 9
A deployment script needs an API key for a language model. The security team requires that the key be rotated every 90 days without changing application code. Where should the key live?
- AHard-coded in source control with a comment noting the rotation schedule, in each environment
- BIn an Azure Key Vault secret with a rotation policy, read at runtime by a managed identity
- CIn a Dockerfile build argument passed with --build-arg baked into the image layer and visible in docker history
- DIn a Git tag annotation message attached to the release commit on the main branch
Show answer and explanationHide answer
Correct answer: BKey Vault stores the secret centrally, supports rotation, and the app reads the current version at runtime using a managed identity without credentials in code. Hard-coded or image-embedded secrets cannot be rotated without redeploying.
Question 10
A team needs non-secret feature flags and endpoint settings shared between an App Service and a Container App, with the ability to change them without a redeploy. Which service is designed for this?
- AAzure Container Registry
- BAzure Key Vault
- CAzure Service Bus
- DAzure App Configuration
Show answer and explanationHide answer
Correct answer: DAzure App Configuration stores key-value settings and feature flags centrally and supports dynamic refresh. Key Vault is for secrets and certificates, not general configuration, and the other two services have unrelated purposes.
Question 11
A distributed AI pipeline spans an API, a queue consumer, and a vector database. The team wants one trace that shows a single user request across all three services. Which instrumentation approach fits?
- AWrite each service's logs to separate text files with local timestamps and rotate them
- BEnable resource-level diagnostic logs on the database instance with a retention period of seven days
- CSample CPU counters once per hour from the host VM through the metrics agent with a fixed interval
- DInstrument all services with OpenTelemetry SDKs and propagate trace context across calls and messages
Show answer and explanationHide answer
Correct answer: DOpenTelemetry provides distributed tracing, and propagating trace context through HTTP headers and message properties links spans across services into one trace. Separate log files or resource-level metrics do not connect a single request across components.
Question 12
In Log Analytics, an engineer wants the number of failed requests per five-minute window for an App Service over the last day. Which KQL pattern is the best starting point?
- AAppRequests | where TimeGenerated > ago(1d) | where Success == false | summarize count() by bin(TimeGenerated, 5m)
- BSELECT COUNT(*) FROM requests WHERE success = 0 AND timestamp >= NOW() - 1 DAY GROUP BY window
- Cshow tables | where TableName startswith 'App' | project TableName, RowCount | render pie chart
- DGet-AzWebApp | Restart-AzWebApp -ResourceGroupName rg-prod -Name app-prod -Force | Format-Table
Show answer and explanationHide answer
Correct answer: AKQL filters the time range and failure status, then summarizes counts into five-minute bins. The other options use SQL syntax, a non-query command, or a PowerShell cmdlet that does not query telemetry.
Question 13
A container app in an AKS cluster repeatedly restarts. Which two signals should the engineer check first to find the cause? (Choose two.)
- APod events such as OOMKilled or failed probes
- BThe subscription's billing invoice
- CContainer logs from the previous terminated instance
- DThe Azure DNS zone list
- EThe Git branch protection rules
Show answer and explanationHide answer
Correct answer: A, CKubernetes events show reasons such as OOMKilled or liveness probe failures, and logs from the previous container instance show the error that caused the crash. Billing, DNS zones, and branch rules do not explain container restarts.
Question 14
A function app reads secrets from Key Vault through a Key Vault reference in its app settings. Requests now fail with a forbidden error after the team moved the vault to use Azure RBAC. What is the most likely cause?
- AThe function app has too many app settings defined in its configuration
- BThe app is running on a Linux consumption plan with a Python worker
- CThe vault name uses hyphens, which blocks the secret lookup from the app
- DThe managed identity has no RBAC role such as Key Vault Secrets User on the vault
Show answer and explanationHide answer
Correct answer: DWhen a vault uses Azure RBAC for data access, the identity must hold a data-plane role such as Key Vault Secrets User. The old access policy model no longer grants access in that mode.
Question 15
An App Configuration store holds a feature flag that switches a new AI summary feature on for a subset of users. The team wants the flag changed in production without redeploying. Which App Configuration capability should the application use?
- AFeature management with feature flags and a dynamic refresh of settings
- BKey Vault certificate rotation policy for TLS certificates on the app
- CBlob storage versioning of the stored objects with automatic snapshot
- DContainer Registry webhooks that notify the pipeline on image push
Show answer and explanationHide answer
Correct answer: AApp Configuration feature flags can be evaluated at runtime, and the app can refresh settings without a restart or redeploy. Key Vault, Blob versioning, and registry webhooks serve different purposes.
Question 16
A development team needs a function to call a downstream API using an Entra ID identity rather than a shared password. Which mechanism should they use for the function?
- AA user name and password stored in the function's host.json under app settings
- BA shared storage account key in an environment variable read at each invocation
- CAn anonymous HTTP trigger with no authentication level set
- DA system-assigned managed identity granted access to the downstream API
Show answer and explanationHide answer
Correct answer: DA managed identity lets the function obtain Entra ID tokens without storing credentials, and access can be granted per resource. Stored passwords and account keys are the credentials the question is trying to avoid.
Develop containerized solutions on Azure (7 questions)
Question 17
A team keeps its Dockerfile in a Git repository and wants each commit to build the image inside Azure, with the result pushed to their Azure Container Registry without running a local Docker daemon. Which registry feature should they use?
- AAzure Image Builder
- BACR Tasks
- CAzure Automation runbooks
- DAzure DevOps Artifacts feeds
Show answer and explanationHide answer
Correct answer: BACR Tasks builds and pushes container images inside the registry, and can be triggered by a source code commit or a base image update. Azure Image Builder produces virtual machine images, not container images, so it is the main distractor.
Question 18
An App Service web app must read a database connection string stored in Azure Key Vault. The app should not contain the secret value in its configuration. What is the recommended approach?
- APaste the raw secret into an app setting marked slot-sticky so it stays with production during each swap, with HTTPS protecting it in transit.
- BStore the secret in a plain-text config file under the app's wwwroot folder, which the Kudu console exposes, so the runtime loads it at startup.
- CCreate an app setting whose value is a Key Vault reference and grant the app's managed identity read access to the secret
- DEmbed the secret in the Dockerfile as an ENV instruction during the image build, so each container started from that image inherits the credential.
Show answer and explanationHide answer
Correct answer: CA Key Vault reference in an app setting is resolved by App Service at runtime using the app's managed identity, so the value never sits in the app configuration. Embedding the secret in the image or in wwwroot exposes it to anyone who can read the image or the files.
Question 19
An Azure Container Apps app consumes messages from an Azure Service Bus queue. The team wants the number of replicas to rise and fall with the queue backlog, including scaling to zero when the queue is empty. Which mechanism provides this?
- AA KEDA-based scale rule that uses the Service Bus queue length
- BA Virtual Machine Scale Set autoscale profile that adds VMs when CPU load rises
- CA CPU-based horizontal pod autoscaler defined in a manifest that scales on CPU
- DAn Azure Monitor action group that restarts the revision
Show answer and explanationHide answer
Correct answer: AContainer Apps implements event-driven scaling with KEDA scalers, and the Service Bus scaler reads queue length to set the replica count, including scale to zero. CPU-based autoscaling does not react to queue backlog, and a Kubernetes HPA manifest is not how Container Apps scale rules are declared.
Question 20
A Container Apps deployment must send 10 percent of production traffic to a new revision for testing before a full cutover. Which two capabilities enable this? (Choose two.)
- ARunning the app in multiple revision mode
- BSetting the app to single revision mode and redeploying in place
- CAssigning a revision label and routing traffic to it
- DCreating a new Container Apps environment for each release
- EChanging the container image tag without creating a revision
Show answer and explanationHide answer
Correct answer: A, CMultiple revision mode keeps several revisions active so traffic weights can be split between them, and revision labels give a stable URL to a specific revision for targeted testing. Single revision mode replaces the active revision, and changing a value in the template creates a new revision rather than being a way to skip one.
Question 21
An AKS team needs a stable internal DNS name and load-balanced access to a set of pods whose IP addresses change on every restart. Which Kubernetes object should the team define in its manifest?
- AA Service
- BA ReplicaSet
- CA PersistentVolumeClaim
- DA ConfigMap
Show answer and explanationHide answer
Correct answer: AA Service gives a stable virtual IP and DNS name and load balances across the pods selected by its label selector. A ReplicaSet maintains pod count but provides no stable endpoint, and a ConfigMap only holds configuration data.
Question 22
A developer needs to see the stdout output of a single container in an Azure Container Apps revision during an incident. Which command is the most direct way to stream those console logs from the Azure CLI?
- Aaz aks get-credentials to refresh the kubeconfig context for the cluster
- Baz monitor activity-log list for the resource group, filtered to the last hour
- Caz acr repository show-manifests in the registry for the image digest
- Daz containerapp logs show with the container name and --follow
Show answer and explanationHide answer
Correct answer: Daz containerapp logs show streams console logs for a named container, and --follow keeps the stream open. The activity log records control plane operations, not container output, and the other two commands do not return container logs.
Question 23
A container image is tagged with a mutable tag such as latest and the team wants every deployment to be traceable to an exact build. What should the pipeline do?
- ATag each image with a unique value such as the commit SHA or build number and deploy that tag
- BPush just the latest tag and rely on the image digests that the portal records for each repository and tag
- CDelete older images from the registry after each push to free space in the repository and retain the newest image
- DUse an Azure Cache for Redis key to store the full image name at deploy time
Show answer and explanationHide answer
Correct answer: AUnique immutable tags, such as the commit SHA or build number, make each deployment traceable to a specific build. A mutable latest tag can point to different images over time, which breaks reproducibility.
Connect to and consume Azure services (7 questions)
Question 24
An order service publishes order events, and a billing service must receive them reliably even if billing is offline for an hour. Messages that cannot be processed after several attempts must be kept for inspection. Which Azure Service Bus construct fits best?
- AStorage queue with visibility timeout of zero so messages reappear until processing succeeds
- BEvent Hubs partition with no retention configured, so consumers read each event once as it arrives
- CTopic with subscriptions, using the dead-letter queue of each subscription for poison messages
- DNotification Hubs installation that registers device tokens for push delivery
Show answer and explanationHide answer
Correct answer: CA topic with subscriptions gives each consumer its own durable copy, and messages that exceed the max delivery count move to that subscription's dead-letter queue for inspection. Event Hubs is built for streaming telemetry, and Storage queues lack topic subscriptions and built-in dead-letter handling of that kind.
Question 25
A Service Bus consumer sometimes fails to process a message because the payload is malformed. The team wants the bad message to stop being retried and be parked for review. What should the consumer do?
- ACall abandon on the message repeatedly until its time to live expires
- BCall complete on the message after logging the malformed payload
- CCall dead-letter on the message with a reason and description
- DRestart the Service Bus namespace to flush messages
Show answer and explanationHide answer
Correct answer: CDead-lettering moves the message out of the active queue and lets you attach a reason and description for review. Abandoning returns the message for redelivery, and completing it removes the message without preserving it for inspection.
Question 26
An Event Grid subscription should only forward events where the subject begins with /blobServices/default/containers/uploads and the event type is Microsoft.Storage.BlobCreated. Where should this rule be configured?
- AIn the storage account's lifecycle policy
- BIn the Azure Function's host.json
- CIn the Key Vault access policy
- DIn the event subscription filters
Show answer and explanationHide answer
Correct answer: DEvent Grid event subscriptions support subject and event type filters, so non-matching events are never delivered to the handler. host.json controls function host behaviour, and lifecycle policies and Key Vault policies do not filter Event Grid events.
Question 27
A team is building an HTTP API as an Azure Function that must run only when a POST request arrives and return a JSON response. Which trigger and binding combination matches this?
- ATimer trigger with a queue output binding
- BEvent Hub trigger with a Service Bus output
- CHTTP trigger with an HTTP response output
- DBlob trigger with a Cosmos DB input binding
Show answer and explanationHide answer
Correct answer: CAn HTTP trigger starts the function on incoming requests, and the response can be returned as the function output. Timer and blob triggers start on a schedule or blob changes, not on HTTP requests.
Question 28
A function app needs to read a Service Bus message and write a record to Cosmos DB in the same invocation without writing the SDK boilerplate. Which approach uses bindings most appropriately?
- ADeclare a Service Bus trigger and a Cosmos DB output binding in function.json or with decorators
- BCall the Azure Resource Manager REST API inside the function to write the record
- CUse an Azure Logic App designer step with no code, chaining a Service Bus connector to a Cosmos DB connector
- DInstall a custom Azure Functions extension package for each record and compile a separate binding assembly
Show answer and explanationHide answer
Correct answer: ATriggers and bindings let the runtime handle the Service Bus receive and Cosmos DB write, so the function focuses on business logic. Calling ARM is for management operations and is not how data bindings are used.
Question 29
A Service Bus topic has a subscription for a reporting service. The reporting team wants only messages with a property region set to EU to reach that subscription. Which feature is used?
- AA session ID set to EU on every message for ordered reads
- BA separate Service Bus namespace per region for traffic routing
- CA subscription filter with a SQL-like rule on the region property
- DA scheduled message with a delivery time for later processing
Show answer and explanationHide answer
Correct answer: CService Bus subscriptions support SQL filters that evaluate message properties, so only matching messages are delivered to the subscription. Sessions group related messages for ordered processing and do not select messages by property.
Question 30
A producer sends an order message and the consumer crashes after reading it but before finishing the work. The team needs the message to be redelivered and not lost. Which Service Bus receive mode and settlement pattern supports this?
- APeek-lock mode with the message completed only after successful processing
- BReceive-and-delete mode, which removes the message on first read
- CPeek-lock mode with an immediate complete call before processing
- DReceive-and-delete mode with a manual retry loop that re-reads the message on each failure
Show answer and explanationHide answer
Correct answer: APeek-lock keeps the message locked until the consumer completes it, so an abandoned or crashed lock returns the message for redelivery. Receive-and-delete removes the message as soon as it is read, which risks losing it.
Want more AI-200 questions?
The full bank has 100 questions with answers and explanations, as a PDF, an online practice exam, or both.
Both formats together. The best value.
Instant access after payment, with 90 days of updates. Checkout is on our store, AIExamCerts.