Microsoft certification · Exam AI-200

AI-200 Mock Exam Page 4

Developing AI Cloud Solutions on Azure

Free AI-200 mock exam questions 31–40, each with the answer and an explanation.

20 questions · 40 minutes · free, no sign-up

Free AI-200 questions

31–40 of 42 free
Question 31 Choose 2
You have container source code stored in a Git repository
The container registry must automatically build and store a new container image whenever a developer commits code to the Git repository.
You must minimize the use of an external build infrastructure.
You need to configure Azure Container Registry (ACR) to manage the build process natively and automatically.
Which two ACR components should you use? Each correct answer presents part of the solution. NOTE: Each correct selection is worth one point.
Show answerHide answer

Correct answer: B, D Quick task Source-triggered task

Explanation

Explanation

To automate container builds natively in Azure Container Registry (ACR) upon a Git commit while minimizing external build infrastructure, you use ACR Tasks.

D. Source-triggered task: This is the core component. You configure a multi-step or Docker build task with a source trigger (--source-trigger-enabled). ACR monitors your connected GitHub or Azure DevOps repository. When a developer commits code, the trigger fires, and ACR executes the build in the cloud, storing the resulting image in the registry. This eliminates the need for external CI/CD agents (like GitHub Actions runners or Jenkins) for the build process.

B. Quick task: To set up this automated pipeline initially, you use the az acr build command, often referred to as a Quick Task. This command allows you to build an image immediately from a local context or a remote Git repository without setting up a full pipeline. In the context of the exam, executing a Quick Task is the mechanism used to establish and initiate the build process from source code.

Why the Other Options Are Incorrect

A. Webhook: ACR webhooks are used to notify external systems (like a listening server or Azure Logic App) when an image is pushed or deleted. They do not trigger builds; they react to completed builds.

C. Artifact Cache rule: This is a feature used in ACR to cache artifacts (like Helm charts or OCI artifacts) from public registries (e.g., Docker Hub) to improve pull performance and reduce egress costs. It does not build container images from source code.

References

Microsoft Learn: Automate container builds with ACR Tasks (Explains source-triggered tasks).
Question 32 Choose 2
You are designing an Azure Function that will process orders from a new Azure Service Bus queue. You need to prevent the system from processing messages more than once and preserve failed messages for investigation. Which two actions should you implement? Each correct answer presents part of the solution. NOTE: Each correct selection is worth one point.
Show answerHide answer

Correct answer: A, C Include a dead-letter handling process. Enable duplicate detection on the queue.

Explanation

Explanation

To meet the two requirements—preventing double processing and preserving failed messages—you must use specific Service Bus features:

C. Enable duplicate detection on the queue: Service Bus can automatically detect and remove duplicate messages sent to a queue or topic. When enabled, Service Bus tracks the MessageId of all incoming messages within a specified time window (the duplicate detection history). If a message with the same MessageId is sent during that window, it is dropped and not processed. This prevents duplicate orders from being processed.

A. Include a dead-letter handling process: If the Azure Function fails to process a valid message (e.g., due to a malformed payload or repeated processing errors), Service Bus will automatically move the message to the Dead-Letter Queue (DLQ) after the maximum delivery count is reached. Implementing a process to monitor, review, and requeue messages from the DLQ ensures failed messages are preserved for investigation rather than being lost or blocking the queue.

Why the Other Options Are Incorrect

B. Process orders by using an HTTP trigger: HTTP triggers are synchronous and not designed to consume messages from a Service Bus queue. A Service Bus trigger is required.

D. Enable sessions on Service Bus: Sessions are used to guarantee First-In-First-Out (FIFO) ordering and grouping of related messages. While useful for ordered processing, sessions do not inherently prevent duplicate message delivery (idempotency) or preserve failed messages for investigation.

References

Microsoft Learn: Duplicate detection in Azure Service Bus
Question 33
You are developing several microservices to run on Azure Container Apps.
You need to monitor and diagnose the microservices.
Which features should you use? To answer, select the appropriate feature in the answer area.
NOTE: Each correct selection is worth one point.
Show answerHide answer

Explanation



Explanation

Log streaming: This feature allows you to view the standard output (stdout) and standard error (stderr) logs of your containerized application in near real-time directly from the Azure portal or CLI. It is the best tool for observing live application behavior and troubleshooting issues as they happen without waiting for logs to be ingested into a logging backend.

Container console: This feature provides an interactive shell (like /bin/bash or /bin/sh) directly inside a running container instance. It allows you to execute commands, inspect the file system, and run diagnostic tools within the exact environment where your microservice is running, which is essential for in-depth debugging.

Why the Other Options Are Incorrect

Azure Monitor metrics: Provides numerical time-series data (like CPU and memory usage) but does not show application console output or allow interactive debugging.

Azure Monitor Log Analytics: Used for querying historical logs using KQL. While excellent for retrospective analysis, it involves ingestion latency and is not "near real-time" for live troubleshooting.

Azure Container Registry: This is a private registry for storing and managing container images. It is not a diagnostic tool.

References

Microsoft Learn: View log streams in Azure Container Apps
Question 34 Choose 1
You deploy multiple instances of a change feed processor to handle a high ingestion rate within Azure Cosmos DB for NoSQL. Each processor instance must process a different subset of partitions. You need to ensure the workload is load-balanced across all processor instances. What should you configure?
Show answerHide answer

Correct answer: C lease container

Explanation

Explanation

When deploying multiple instances of a Change Feed Processor to handle a high ingestion rate, the processor instances must coordinate with each other to divide the work. They do this by using a lease container.

The lease container stores the lease documents (state) for each partition. Each processor instance acquires leases for a subset of the partitions. If a new instance starts, it acquires available leases to share the load. If an instance fails, its leases expire and are picked up by other instances. This ensures that partitions are distributed dynamically and the workload is perfectly load-balanced across all active processor instances. Crucially, a lease ensures that only one processor instance is reading a specific partition at a time.

Why the Other Options Are Incorrect

A. indexing precision: This is a setting that defines how often the database index is updated (Consistent or Lazy). It affects write performance and query consistency, not the load balancing of change feed processor instances.

B. strong consistency: This is an account-level data replication setting. It ensures reads reflect the most recent write, but it has no impact on how background processors distribute partition workloads.

D. autoscale throughput: This dynamically adjusts the Request Units (RUs) provisioned for the database based on traffic. While important for performance, it does not manage the distribution of partitions among multiple compute instances.

References

Microsoft Learn: Change feed processor in Azure Cosmos DB (Explains how the lease container manages partition distribution and load balancing).
Question 35 Choose 1
You have an Azure subscription named Sub1 that contains a resource group named RG1 and a Service Bus queue named SB1. You plan to implement an Azure Event Grid push even: subscription that will deliver an event lo SB1 whenever a resource is created, modified, or deleted in RG1. You must minimize the development and configuration efforts. You need to create an Event Grid topic for your planned implementation Which type of event topic should you create?
Show answerHide answer

Correct answer: B system

Explanation

Explanation

You should create a system topic. In Azure Event Grid, system topics are automatically created and managed by Azure services (in this case, Azure Resource Manager). They represent events that originate from Azure resources, such as resource creation, modification, or deletion within a resource group.

Because you are subscribing to events generated by the Azure platform itself (resource changes in RG1) and the requirement is to minimize development and configuration efforts, using a system topic is the correct approach. You do not need to write custom code to publish events to a custom topic; you simply create an Event Grid subscription on the resource group, and Azure automatically provisions the system topic and routes the events to your Service Bus queue.

Why the Other Options Are Incorrect

A. custom: Custom topics are used when you need to publish your own application events to Event Grid. You would have to build and configure an application to publish events to the topic, which violates the requirement to minimize development efforts.

C. event domain: Event domains are used to manage events for multi-tenant SaaS applications where you need to route events to thousands of different customers. They are unnecessary for a single resource group scenario.

D. namespace: (Assuming this refers to Event Grid Namespaces, which are part of the newer Event Grid Namespaces feature for MQTT and pull-based delivery). It is not the standard topic type for Azure resource events.

References

Microsoft Learn: System topics in Azure Event Grid
Question 36
You are building a semantic search feature for a chatbot. You store document embeddings in Redis. You review the following Python code that connects to Redis and stores an embedding value:

For each of the following statements, select Yes if the statement is true. Otherwise, select No. NOTE: Each correct selection is worth one point.
Show answerHide answer

Explanation



Explanation

Statement 1 (Yes): Line 10 uses the r.hset("doc:1", mapping={"embedding": embedding}) command. HSET is the Redis command for setting fields in a hash. This stores the embedding as a field within the hash named doc:1.

Statement 2 (No): The code only saves the embedding as a raw byte string (using tobytes() on line 3). It does not create a vector index or specify a vector distance metric. Without defining an index (e.g., using FT.CREATE via Redis Search), Redis cannot perform similarity searches on this field; it can only store and retrieve it.

Statement 3 (Yes): Line 11 uses the r.expire("doc:1", 600) command. The expire command sets a timeout on a key in seconds. Since 600 seconds equals 10 minutes, the key (and its hash field) will automatically expire after exactly 10 minutes.

References

Microsoft Learn: Redis HSET command
Question 37 Choose 1
You deploy a production Azure Function app that connects to an Azure SQL Database.
The solution must provide the following functionality:

• Prevent secrets from being exposed in source control.
• Support secret rotation without redeploying the function app.
• Avoid downtime during credential updates.

You need to configure secure and maintainable secret management. What should you configure?
Show answerHide answer

Correct answer: A Application settings with Key Vault references

Explanation


Explanation

Application settings with Key Vault references is the only option that meets all three requirements:

Prevent secrets from being exposed in source control: By storing the actual connection string in Azure Key Vault and only placing a reference URI in the Function App's application settings, no sensitive data is ever stored in your code repository.

Support secret rotation without redeploying: When the secret is rotated in Key Vault, the Function App automatically fetches the new version. You do not need to change code or redeploy the application.

Avoid downtime during credential updates: Key Vault references are resolved at runtime. Because the Function App retrieves the latest secret seamlessly, there is no need to restart or redeploy, preventing service interruptions during credential updates.

Why the Other Options Are Incorrect

B. Environment variables in local.settings.json: This file is typically used for local development and is often (or should be) excluded from source control. It does not support dynamic secret rotation without manual updates and redeployments, and storing secrets in plaintext locally is a security risk.

C. Parameter file stored in source control: Storing any file containing plaintext secrets in source control violates the first requirement directly, as anyone with repository access could view the credentials.

D. Hard coded connection string in the startup class: This is the worst security practice. It exposes secrets directly in the codebase and requires a full code change and redeployment to rotate credentials.

References

Microsoft Learn: Use Key Vault references as app settings in Azure App Service and Azure Functions
Question 38
You are developing a .NET application that uses Azure Cosmos DB for NoSQL to store application data The application uses the Azure Cosmos DB for NoSQL SDK to interact with the database account. The application must perform the following tasks
• Initialize the connection by using the account endpoint and key.
• Define shared throughput.
• Perform create, read, update, and delete (CRUD) operations on items stored in a container
Show answerHide answer

Explanation



Explanation

CosmosClient: This is the top-level object in the SDK hierarchy. It represents the connection to the Cosmos DB account. You initialize it by passing the account's endpoint URI and key to establish the connection and manage the client lifecycle.

Database: In Cosmos DB, a database acts as a logical grouping for containers. When you provision throughput at the database level, it is called shared throughput, meaning the allocated Request Units (RUs) are shared across all containers within that database.

Container: The container is the actual storage unit where your JSON documents reside. To perform Create, Read, Update, and Delete (CRUD) operations, you obtain a reference to the specific container from the database object and use its methods to manipulate the items.

Why the Other Option Is Incorrect

Indexing policy: This is a configuration setting applied to a container that defines how data is automatically indexed for query performance. It is not used to initialize connections, define throughput, or execute CRUD operations.

References

Microsoft Learn: Azure Cosmos DB .NET SDK v3 - CosmosClient class
Question 39
A company has an Azure Cosmos DB for NoSQL account. The account is configured for session consistency.
Data is written to a single Azure region and data can be read from three Azure regions.
An application that will access the Azure Cosmos DB for NoSQL container data using an SDK has the following requirements:
• Roads from the application must return the most recent committed version of an Item from any Azure region.
The container items should not automatically be deleted.
You need to implement the changes to the Azure Cosmos DB for NoSQL account. What should you do? To answer, select the appropriate options in the answer area
Show answerHide answer

Explanation



Explanation

Change the consistency level by using the SDK: The account is configured for Session consistency, which only guarantees reads reflect the most recent write within the same session. To guarantee reading the most recently committed version globally (from any of the read regions), you need Strong consistency. Because changing the account default affects all applications globally and can cause higher latency, the best practice is to override the consistency level to Strong on a per-request basis in your application code using the SDK's request options.

Change the Time to Live (TTL) property on items to -1: If you want to ensure that items are never automatically deleted by the database's background cleanup process, the TTL must be disabled. In Cosmos DB, setting the TTL to -1 signifies "no expiration" (items will not be deleted automatically).

Why the Other Options Are Incorrect

Change the default consistency level on the account: While this would achieve Strong consistency, it forces this strict level on all operations and applications, which can heavily impact performance and availability. SDK-level overrides are preferred for specific reads.

Configure a resource lock: Resource locks prevent users from accidentally deleting the account, database, or container via the Azure management plane. They do not prevent Cosmos DB from expiring and deleting individual items based on a TTL policy.

References

Microsoft Learn: Override consistency level in the SDK
Question 40
A Python API retrieves a document from Azure Database for PostgreSQL by using a SQL statement. The API accepts the document ID from user input. The current implementation inserts the document ID directly into the SQL statement.
You need to secure the SQL statement execution by using a parameterized query. You must minimize the possibility of SQL injection.
How should you update the implementation to execute the SQL statement safely? To answer, move the appropriate configurations to the correct requirements. You may use each configuration once, more than once, or not at all. you may need to move the split bar between panes or scroll to view content.
NOTE: Each correct selection is worth one point.
Show answerHide answer

Explanation



Explanation

Use a parameterized query: Instead of string concatenation (e.g., "SELECT * FROM docs WHERE id = '" + input + "'"), you must modify the SQL statement to use placeholders (e.g., %s for Python's psycopg2). This structurally separates the SQL command from the data.

Pass the ID as an argument: To bind the user input safely, you pass the ID through a separate tuple or dictionary argument. This ensures the database driver handles the input strictly as data, neutralizing any malicious SQL syntax (preventing SQL injection).

Supply the parameter tuple to the SDK method: When executing the query via the Python database driver (e.g., cursor.execute(query, (user_id,))), you supply the parameter tuple as the second argument. The driver then safely escapes and binds the data to the placeholders.

Why the Other Option Is Incorrect

Escape quotation marks in the ID: Manual escaping is error-prone and relies on the developer perfectly anticipating every possible malicious input. Parameterization is the industry standard because it delegates safe input handling entirely to the database driver.

References

Microsoft Learn: Prevent SQL injection in Azure Database for PostgreSQL
Full mock exam

Sit the AI-200 exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real AI-200 exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full AI-200 mock exam
  • 60questions per mock
  • 120 mintime limit
  • 142questions in the bank
  • Newmock on every attempt