Free DP-420 Exam Braindumps
Designing and Implementing Cloud-Native Applications Using Microsoft Azure Cosmos DB Questions 76–80 (page: 17)

Updated On: 16-Nov-2026
View Related Case Study

You need to create a data store for a directory of small and medium-sized businesses (SMBs). The data store must meet the following requirements:
-Store companies and the users employed by them. Each company will have less than 1,000 users.
-Some users have data that is greater than 2 KB.
-Associate each user to only one company.
-Provide the ability to browse by company.
-Provide the ability to browse the users by company.
-Whenever a company or user profile is selected, show a details page for the company and all the related users.
-Be optimized for reading data.
Which design should you implement to optimize the data store for reading data?

  1. In a directory container, create a document for each company and a document for each user. Use the company ID as the partition key.
  2. Create a user container that uses the user ID as the partition key and a company container that uses the company ID as the partition key. Add the company ID to each user document.
  3. In a user container, create a document for each user. Embed the company into each user document. Use the user ID as the partition key.
  4. In a company container, create a document for each company. Embed the users into company documents. Use the company ID as the partition key.

Answer(s): D

Explanation:

All employees within a company would nicely fit within a single document (document size 2 MB).
Note: An Azure Cosmos container is the unit of scalability both for provisioned throughput and storage. A container is horizontally partitioned and then replicated across multiple regions. The items that you add to the container are automatically grouped into logical partitions, which are distributed across physical partitions, based on the partition key.


Reference:

https://docs.microsoft.com/en-us/azure/cosmos-db/set-throughput



View Related Case Study

You are designing an Azure Cosmos DB for NoSQL solution to store data from IoT devices. Writes from the devices will be occur every second. Data will be retained indefinitely.
The following is a sample of the data.

You need to select a partition key that meets the following requirements for writes:
-Minimizes the partition skew
-Avoids capacity limits
-Avoids hot partitions
What should you do?

  1. Use timestamp as the partition key.
  2. Create a new synthetic key that contains deviceId and sensor1Value.
  3. Create a new synthetic key that contains deviceId and deviceManufacturer.
  4. Create a new synthetic key that contains deviceId and a random number.

Answer(s): D

Explanation:

Correct:
* Create a new synthetic key that contains deviceId and a random number.
Use a partition key with a random suffix. Distribute the workload more evenly is to append a random number at the end of the partition key value.
When you distribute items in this way, you can perform parallel write operations across partitions.
* Create a new synthetic key that contains deviceId and timestamp.
Concatenate multiple properties of an item.
You can form a partition key by concatenating multiple property values into a single artificial partitionKey property. These keys are referred to as synthetic keys.
For example, consider the following example document:
{
"deviceId": "abc-123",
"date": 2018
}
For the previous document, one option is to set /deviceId or /date as the partition key. Use this option, if you want to partition your container based on either device ID or date. Another option is to concatenate these two values into a synthetic partitionKey property that's used as the partition key.
{
"deviceId": "abc-123",
"date": 2018,
"partitionKey": "abc-123-2018"
Incorrect:
* Create a new synthetic key that contains deviceId and deviceManufacturer.
All the devices could have the same manufacturer.
* Create a new synthetic key that contains deviceId and sensor1Value.
Senser1Value has only two values.
* Use deviceId as the partition key.
* Use deviceManufacturer as the partition key.
All the devices could have the same manufacturer.
* Use sensor1Value as the partition key
* Use timestamp as the partition key.
You will also not like to partition the data on “DateTime”, because this will create a hot partition. Imagine you have partitioned the data on time, then for a given minute, all the calls will hit one partition. If you need to retrieve the data for a customer, then it will be a fan-out query because data may be distributed on all the partitions.


Reference:

https://docs.microsoft.com/en-us/azure/cosmos-db/sql/synthetic-partition-keys https://docs.microsoft.com/en-us/azure/cosmos-db/concepts-limits



View Related Case Study

You have an application named App1 that reads the data in an Azure Cosmos DB for NoSQL account. App1 runs the same read queries every minute. The default consistency level for the account is set to eventual.
You discover that every query consumes request units (RUs) instead of using the cache.
You verify the IntegratedCacheiteItemHitRate metric and the IntegratedCacheQueryHitRate metric. Both metrics have values of 0.
You verify that the dedicated gateway cluster is provisioned and used in the connection string.
You need to ensure that App1 uses the Azure Cosmos DB integrated cache.
What should you configure?

  1. the indexing policy of the Azure Cosmos DB container
  2. the consistency level of the requests from App1
  3. the connectivity mode of the App1 CosmosClient
  4. the default consistency level of the Azure Cosmos DB account

Answer(s): C

Explanation:

Because the integrated cache is specific to your Azure Cosmos DB account and requires significant CPU and memory, it requires a dedicated gateway node. Connect to Azure Cosmos DB using gateway mode.


Reference:

https://docs.microsoft.com/en-us/azure/cosmos-db/integrated-cache-faq



View Related Case Study

You have an Azure subscription that contains an Azure Cosmos DB for NoSQL database named DB1.
You develop a software as a service (SaaS) app named App1 that uses DB1. App1 will be used by multiple vendors to manage their customers.
You need to create a container in DB1 that will store customer and order details for each vendor. The solution must meet the following requirements:
-Each vendor must have a unique tenant ID.
-The performance of the container must be optimized for reads.
-Customer IDs can be duplicated across the container but must be unique for each vendor.
-The container must be optimized for concurrent queries from multiple customers. Each query will return data for a single vendor.
How should you configure the container?

  1. Add a partition key to the tenant ID and a unique key policy to the customer ID.
  2. Add hierarchical partition key on (tenant identifier, customer identifier).
  3. Add a partition key to the customer ID and a unique key policy to the tenant ID.
  4. Add hierarchical partition key on (customer identifier, tenant identifier).

Answer(s): B

Explanation:

For this multi-tenant SaaS scenario, you should use a hierarchical partition key and a unique key policy. Partitioning Strategy: Hierarchical Partition Key
A hierarchical partition key (subpartitioning) is the optimal choice for your requirements.
Structure: Define the hierarchy as /TenantId followed by /CustomerId.
Why it meets your needs:
Single Vendor Scope: Since every query returns data for a single vendor, including TenantId as the first level of the hierarchy ensures all related data is logically grouped and queries are efficiently routed to the correct partitions.
Scale Beyond 20 GB: Standard partition keys limit a single logical partition (e.g., one vendor) to 20 GB. Hierarchical partitioning allows a single TenantId to scale across multiple physical partitions, supporting larger vendors without hitting storage limits.
Read Optimization: It optimizes concurrent queries from multiple customers by distributing the workload of a single large vendor across different subpartitions.


Reference:

https://devblogs.microsoft.com/cosmosdb/scaling-multi-tenant-go-applications-choosing-the-right-database-par titioning-approach/



View Related Case Study

You have an Azure Cosmos DB for NoSQL database that hosts a container named Container1.
You are developing a new app named App1 that will use Container1.
You need to ensure that when App1 attempts to delete a document in Container1, the action is blocked, and an error is returned to the app.
What should you use?

  1. a post-trigger
  2. a stored procedure
  3. a user-defined function (UDF)
  4. a pre-trigger

Answer(s): D

Explanation:

To block an application from deleting a document in an Azure Cosmos DB for NoSQL container while ensuring the application receives an error message, you should use a pre-trigger.
Why use a Pre-trigger?
Blocking Action: Pre-triggers run before a database operation (like a delete) is completed. If the trigger throws an exception, the entire transaction is aborted, effectively blocking the deletion.
Error Reporting: When a pre-trigger throws an error, the Cosmos DB service returns that error back to the calling application, typically as a 400 Bad Request or similar exception depending on the SDK used.
Granular Control: Unlike general Role-Based Access Control (RBAC) which might just deny the operation with a generic "Forbidden" message, a pre-trigger allows you to write custom
JavaScript logic to validate the delete request and provide a specific error reason.


Reference:

https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-write-stored-procedures-triggers-udfs



Viewing page 17 of 61
Viewing questions 81 - 85 out of 296 questions


Post your Comments and Discuss Microsoft DP-420 exam prep with other Community members:

AI Tutor AI Tutor 👋 I’m here to help!