Chapter 4 · AZ-204: Developing Solutions for Microsoft Azure Develop for Azure Storage
Azure Cosmos DB – Change Feed, Stored Procedures and Triggers
20 practice questions · 5 marks weightage
Practice questions
- Question 1Q-813677See the answer and solution
A .NET service must process new and updated documents from an Azure Cosmos DB container, while allowing multiple service instances to scale out without processing the same work partition concurrently. Which design should the service use?
- A.Use the Change Feed Processor with a lease container to coordinate ownership of change feed partitions.
- B.Create one stored procedure for each service instance and read documents in random order.
- C.Run a cross-partition SQL query repeatedly and use the document ID as the checkpoint.
- D.Register a post-trigger that continuously polls the container for changes.
- Question 2Q-5BC049See the answer and solution
A stored procedure in Azure Cosmos DB must insert three documents and update a fourth document as one atomic operation. What is required for this operation to be transactional?
- A.All documents must be stored in the same logical partition, and the stored procedure must be executed with that partition key.
- B.The stored procedure must use a cross-partition query and specify the container's physical partition count.
- C.The documents can be in different logical partitions as long as they are in the same Cosmos DB container.
- D.The operation must be implemented with a post-trigger because stored procedures cannot provide transactional behavior.
- Question 3Q-A6D3B4See the answer and solution
An application has a Cosmos DB pre-trigger named ValidateOrder. The developer expects the trigger to run automatically whenever any client creates an order in the container. What change is required to meet this expectation?
- A.Rename the trigger so that it begins with the prefix pre-.
- B.Configure the trigger as a database-level trigger in the Azure portal.
- C.Explicitly include ValidateOrder in the create-item request's pre-trigger options for every request that requires it.
- D.Convert the pre-trigger to a change feed processor because triggers run only for updates.
- Question 4Q-81B619See the answer and solution
A Cosmos DB container uses customerId as its partition key. A change feed consumer receives changes for customers C100 and C200. Which ordering guarantee can the consumer rely on?
- A.Changes for all customers are globally ordered by timestamp.
- B.Changes are ordered within a logical partition, but no global ordering is guaranteed across customers.
- C.Changes are ordered alphabetically by the partition key value.
- D.Changes are always delivered in the order in which consumers request them.
- Question 5Q-42686ESee the answer and solution
An application uses the default latest-version mode of the Azure Cosmos DB change feed. It must reliably notify another system when a customer document is deleted, but it cannot change the delete operation to use a separate notification API. What is the most reliable design?
- A.Read the change feed with a shorter polling interval.
- B.Use a pre-trigger because change feed entries are generated only by triggers.
- C.Replace physical deletion with an update that marks the document as deleted, and process that update from the change feed.
- D.Read the change feed from the beginning after every delete operation.
15 more questions on Azure Cosmos DB – Change Feed, Stored Procedures and Triggers
Sign up free to practise the full chapter. Questions you get wrong come back until you've mastered them.
Start practising freeFree to start · No credit card needed