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

  1. Question 1Q-1BC9F8

    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?

    1. A.Eventual
    2. B.Session
    3. C.Consistent prefix
    4. D.Strong
    See the answer and solution
  2. Question 2Q-40BF91

    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?

    1. A.Keep /tenantId because all queries include the tenant identifier.
    2. B.Use /timestamp so recent telemetry is always placed together.
    3. C.Use a high-cardinality synthetic key such as tenantId + ':' + deviceId.
    4. D.Use the tenant's display name and manually move items between partitions.
    See the answer and solution
  3. Question 3Q-D045B1

    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?

    1. A.await container.ReadItemAsync<Order>("order-42", new PartitionKey("contoso"));
    2. B.await container.ReadItemAsync<Order>(new PartitionKey("contoso"), "order-42");
    3. C.await container.ReadItemAsync<Order>("order-42");
    4. D.await container.GetItemQueryIterator<Order>("SELECT * FROM c WHERE c.id = 'order-42'").ReadNextAsync();
    See the answer and solution
  4. Question 4Q-E43C77

    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?

    1. A.Eventual consistency
    2. B.Consistent prefix consistency
    3. C.Bounded staleness consistency
    4. D.Strong consistency
    See the answer and solution
  5. Question 5Q-67E383

    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?

    1. A./orderStatus
    2. B./orderDate
    3. C./storeId
    4. D./customerType
    See the answer and solution

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 free

Free to start · No credit card needed