Chapter 3 · AZ-204: Developing Solutions for Microsoft Azure Develop for Azure Storage
Azure Cosmos DB – Consistency, Partitioning and SDK
20 practice questions · 5 marks weightage
Practice questions
- Question 1Q-1BC9F8See the answer and solution
An application uses Azure Cosmos DB to update a user's profile and then immediately read the profile during the same user session. The read must reflect the user's preceding write, while the application should avoid the stronger global coordination of strong consistency. Which consistency level is most appropriate?
- A.Eventual
- B.Session
- C.Consistent prefix
- D.Strong
- Question 2Q-40BF91See the answer and solution
A Cosmos DB container stores telemetry for many tenants. Its current partition key is /tenantId, but one tenant produces most of the telemetry, causing a hot logical partition and uneven request distribution. Queries commonly filter by tenant and time, and transactions do not need to span multiple devices. Which redesign is most appropriate?
- A.Keep /tenantId because all queries include the tenant identifier.
- B.Use /timestamp so recent telemetry is always placed together.
- C.Use a high-cardinality synthetic key such as tenantId + ':' + deviceId.
- D.Use the tenant's display name and manually move items between partitions.
- Question 3Q-D045B1See the answer and solution
A .NET application uses the Azure Cosmos DB SDK v3. The container's partition key path is /customerId, and the application must retrieve the item with id order-42 for customer contoso using a point read. Which statement correctly performs the operation?
- A.await container.ReadItemAsync<Order>("order-42", new PartitionKey("contoso"));
- B.await container.ReadItemAsync<Order>(new PartitionKey("contoso"), "order-42");
- C.await container.ReadItemAsync<Order>("order-42");
- D.await container.GetItemQueryIterator<Order>("SELECT * FROM c WHERE c.id = 'order-42'").ReadNextAsync();
- Question 4Q-E43C77See the answer and solution
A globally distributed Azure Cosmos DB account must allow reads from any region, but each read may lag behind the latest write by no more than 5 seconds or 100,000 updates, whichever limit is reached first. Which consistency level should be configured?
- A.Eventual consistency
- B.Consistent prefix consistency
- C.Bounded staleness consistency
- D.Strong consistency
- Question 5Q-67E383See the answer and solution
An Azure Cosmos DB container stores orders for 10,000 retail stores. Most queries retrieve orders for a specific store, and writes are distributed relatively evenly across stores. Which partition key is the best choice for the container?
- A./orderStatus
- B./orderDate
- C./storeId
- D./customerType
15 more questions on Azure Cosmos DB – Consistency, Partitioning and SDK
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