Exam AI-200: Developing AI Cloud Solutions on Azure tests caching and connection optimization in its Azure data management domain, worth 30–35% in the official skills summary. It also tests messaging and event workflows in the Connect to and consume Azure services domain, worth 20–25%. These AI-200 caching and events questions cover Redis data operations, PostgreSQL pooling, Service Bus processing, and Event Grid delivery.
This is the third set in our Azure AI Cloud Developer Associate AI-200 series (Questions 21-30). Questions 11-20 covered Cosmos DB and PostgreSQL retrieval. For the earlier published foundation, revisit AI-200 Questions 1-10 on container hosting and scaling. Every question is an original practice scenario mapped to the official exam objectives, not a copy of a real exam item.
Separate expiration from explicit invalidation, and distinguish a competing-consumer queue from topic fan-out. For failed event delivery, check both the retry limit and the event’s lifetime.
Question 21: Handle a Missing Cached Entry
A product-summary API uses Azure Managed Redis with application-managed cache-aside logic. A requested summary is absent from the cache but exists in the authoritative database. The API must return the summary now and reduce database reads for later requests. Which read path should it follow?
A) Return a not-found response and wait for cache maintenance.
B) Query the database and leave the cache entry unpopulated.
C) Insert an empty summary and return it without a database read.
D) Read the database, cache the summary, and return the summary.
👁 Reveal Answer
Correct Answer: D
Explanation: D implements the cache-miss path of cache-aside: load the item from the data store, add it to the cache, and return it. The application owns these steps rather than assuming Redis performs them automatically. A treats a cache miss as proof that the source item is missing. B serves this request but misses the opportunity to reduce later database reads. C caches incorrect content instead of retrieving the existing summary.
Reference: Cache-Aside pattern: loading data on demand
Question 22: Refresh Externally Updated Data
A dashboard caches database summaries in Azure Managed Redis. A separate importer changes the source database without notifying the dashboard. The team accepts a short period of stale data but wants entries to become eligible for reload even when the cache has ample free memory. Which cache policy directly addresses this requirement?
A) Retain each entry indefinitely until memory-pressure eviction.
B) Give each cached summary a finite expiration when stored.
C) Disable expiration and enlarge the cache’s available memory.
D) Refresh only when the dashboard itself writes the source.
👁 Reveal Answer
Correct Answer: B
Explanation: B gives cached summaries a limited lifetime. After expiration, a later cache-aside read can retrieve the updated source value. Choose the expiration period according to acceptable staleness and access patterns; this does not provide immediate consistency. A depends on memory pressure, which might never occur. C can retain stale values even longer. D misses changes made by the separate importer, because the dashboard does not perform those writes.
Reference: Cache-Aside pattern: lifetime and consistency considerations
Question 23: Sequence a Cache-Aside Update
An API uses cache-aside for a shared product record. The team is implementing the standard update path: persist the new value and invalidate its cached copy. It wants to avoid a reader repopulating the cache from the old database value between these two operations. Which order should the API use?
A) Update the database, then remove the corresponding cache entry.
B) Remove the cache entry, then update the database record.
C) Update the cache entry, then leave the database record unchanged.
D) Update the database, then extend the old cache entry’s lifetime.
👁 Reveal Answer
Correct Answer: A
Explanation: A follows the documented cache-aside update sequence. Persist the source change before invalidating the cached item, so a subsequent cache miss can load the new value. Cache-aside still does not guarantee full consistency under every concurrent race. B opens the specific gap in which a reader can reload the old source value before the write. C never persists the intended source change. D deliberately retains stale content instead of invalidating it.
Reference: Cache-Aside pattern: updating the data store and invalidating the cache
Question 24: Prepare Native Similarity Search
A developer is creating a Balanced Azure Managed Redis instance for an embedding-search prototype. The application must perform indexed nearest-neighbor queries inside Redis rather than download every vector for comparison. Which module and policy combination should the developer select during instance creation?
A) RedisBloom with Enterprise clustering and the NoEviction policy.
B) RedisTimeSeries with Enterprise clustering and the NoEviction policy.
C) RediSearch with Enterprise clustering and the NoEviction policy.
D) RedisJSON alone with Enterprise clustering and the NoEviction policy.
👁 Reveal Answer
Correct Answer: C
Explanation: C enables RediSearch, which provides secondary indexing and vector similarity queries, including K-nearest neighbor search. Azure Managed Redis requires Enterprise clustering and NoEviction for this module, and modules must be enabled when the instance is created. A adds probabilistic membership and frequency structures, not vector similarity indexing. B adds time-series operations. D provides JSON storage and manipulation, but RedisJSON alone does not supply the required RediSearch vector-query capability.
Reference: Using Redis modules with Azure Managed Redis: RediSearch
Question 25: Reduce Connection Churn
A Python API issues many short transactions to an Azure Database for PostgreSQL flexible server on the General Purpose tier. Built-in PgBouncer is enabled, and compatibility testing has passed. Connections still use the server hostname on port 5432. Which connection change uses the managed pool with the least infrastructure work?
A) Keep the current hostname and connect through port 5432.
B) Keep the current hostname and connect through port 6432.
C) Keep the current hostname and connect through port 443.
D) Keep the current hostname and connect through port 6379.
👁 Reveal Answer
Correct Answer: B
Explanation: B directs the application to the built-in PgBouncer endpoint on the same database server hostname. Pooling reduces the overhead associated with idle or short-lived PostgreSQL connections without requiring a separate pooler deployment. A continues to connect directly to PostgreSQL rather than the managed pool. C is not the documented PgBouncer listening port. D is also not that endpoint and would not activate PostgreSQL connection pooling.
Reference: PgBouncer in Azure Database for PostgreSQL Flexible Server
Question 26: Settle a Successful Job
A worker receives a Service Bus queue message in PeekLock mode with automatic completion disabled. It successfully commits the job’s result, and its message lock is still valid. The worker must tell the broker that this delivery has finished so the message is removed from the queue. Which settlement should it perform?
A) Abandon the message while keeping the receiver open.
B) Renew the message lock while keeping the receiver open.
C) Dead-letter the message while keeping the receiver open.
D) Complete the message while keeping the receiver open.
👁 Reveal Answer
Correct Answer: D
Explanation: D acknowledges successful processing and removes the message from the queue when settlement succeeds. The receiver and its connection must remain open until settlement finishes. A releases the message for redelivery rather than marking it done. B extends processing time but does not acknowledge completion. C moves a rejected or unprocessable message to the dead-letter queue, which is inappropriate for this successfully completed job.
Reference: Message transfers, locks, and settlement: receive operations
Question 27: Deliver to Independent Workflows
An application sends document-processing notifications through Service Bus. Both an audit service and a search-index service need their own copy of every notification, and either service may be offline temporarily. The publisher should send each notification once. Which entity arrangement provides independent durable consumption?
A) One topic with a separate subscription for each service.
B) One queue with both services acting as competing receivers.
C) One topic with both services sharing a single subscription.
D) Two queues with the publisher sending only to the audit queue.
👁 Reveal Answer
Correct Answer: A
Explanation: A provides publish/subscribe fan-out. Each subscription receives a copy, and each service consumes its own virtual queue independently. With the default matching rule, both subscriptions select every notification. B distributes deliveries among competing receivers rather than giving each service a copy. C makes the services compete within one subscription. D leaves the search-index queue without notifications, because the publisher sends only to the audit queue.
Question 28: Explain an Isolated Failed Message
A Service Bus worker repeatedly abandons one message because its handler fails. An operator later finds that message in the queue’s dead-letter subqueue with reason MaxDeliveryCountExceeded. Other messages process normally. Which interpretation best explains the message’s location without assuming a namespace-wide outage?
A) Its lifetime expired, so the broker assigned a delivery-limit reason.
B) Its last completion succeeded, so the broker retained a recovery copy.
C) Its failed delivery attempts exceeded the entity’s configured limit.
D) Its active lock was renewed, so the broker moved it out of circulation.
👁 Reveal Answer
Correct Answer: C
Explanation: C matches the dead-letter reason. Abandoning a PeekLock delivery increments its delivery count, and exceeding the configured limit moves the message to the DLQ for inspection and recovery. A confuses this with expiration dead-lettering, which uses a different reason. B would remove the successfully settled message rather than create this DLQ entry. D extends a valid lock; it does not produce the reported delivery-count failure.
Reference: Service Bus dead-letter queues: maximum delivery count
Question 29: Filter Before Invoking the Handler
An Event Grid Basic subscription receives custom events in Event Grid schema. Each event has a numeric data.priority field. A handler should receive only events whose priority is greater than 20. The publisher and handler code must remain unchanged. Which subscription advanced filter meets the requirement?
A) Use NumberLessThan on data.priority with value 20.
B) Use NumberGreaterThanOrEquals on data.priority with value 20.
C) Use NumberIn on data.priority with values [20].
D) Use NumberGreaterThan on data.priority with value 20.
👁 Reveal Answer
Correct Answer: D
Explanation: D compares the numeric event-data field against the threshold and selects only values strictly above 20. Subscription filtering controls routing before the handler receives the events, without changing either application’s code. A selects values below the threshold. B also admits priority 20, which the requirement excludes. C selects exactly the listed value 20 rather than the open-ended set of priorities greater than 20.
Reference: Event filtering in Azure Event Grid: advanced numeric operators
Question 30: Interpret a Retry Policy
An Event Grid Basic subscription pushes events to a webhook that keeps returning a retryable server error. The retry policy allows 30 delivery attempts but sets event time-to-live to 60 minutes. A valid dead-letter destination is configured. What happens if an event’s TTL has expired when Event Grid evaluates its next scheduled delivery?
A) Delivery continues until all 30 allowed attempts are exhausted.
B) Delivery stops and the event is scheduled for dead-lettering.
C) The attempt limit resets and a fresh 60-minute lifetime begins.
D) The webhook error counts as success and the event is acknowledged.
👁 Reveal Answer
Correct Answer: B
Explanation: B follows the first-limit-reached rule: delivery stops when either event TTL or the maximum attempt limit is reached. Expiration is evaluated at the next scheduled delivery attempt, so do not assume an exact wall-clock dead-letter arrival time. A incorrectly treats attempts as overriding TTL. C invents a policy reset that would defeat expiration. D misclassifies the retryable failure as an acknowledgment of successful receipt.
Reference: Azure Event Grid delivery and retry: retry policy and dead-letter events
Study Tips for Redis Caching and Event Processing
- Miss versus absence. A missing cache entry can still exist in the authoritative database, so cache-aside reads must handle that distinction.
- Two freshness controls. Expiration limits an entry’s lifetime; explicit invalidation removes a known stale entry after a source update.
- Distribution versus fan-out. Queue receivers compete for work, while separate topic subscriptions give independent services their own copies.
- Delivery limits. Settle Service Bus messages after successful processing, and evaluate both attempts and TTL when reviewing Event Grid retries.
Keep Practicing for Azure AI Cloud Developer
Use these AI-200 caching and events questions with small cache-miss and message-settlement labs. Revisit AI-200 Questions 1-10 for the published container foundation. The next set, Questions 31-40, will cover security and observability, including Key Vault, App Configuration, OpenTelemetry, and KQL.
