Designing and Implementing Cloud-Native Applications Using Microsoft Azure Cosmos DB (DP-420) — Free Practice Questions
10 free sample questions from a bank of 189, with the correct answers and explanations. No signup required — start practising right now.
1You are designing an Azure Cosmos DB Core (SQL) API solution to store data from IoT devices. Writes from the devices will be occur every second.
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?
Create a new synthetic key that contains deviceId and timestamp
Use timestamp as the partition key
Use deviceManufacturer as the partition key
Use sensor1Value as the partition key
Answer: A
The short version
A — build a synthetic key from device plus time. Combining deviceId with timestamp spreads per second writes evenly and avoids hot or skewed partitions in the settled key.
Key concepts in this question
Partition key choice: determines physical distribution and request routing, so cardinality and evenness directly control throughput.
Hot partition: single logical partition receiving disproportionate writes that throttles despite total account capacity.
Skew and limits: low cardinality keys create oversized partitions that hit twenty gigabyte limits and uneven RU consumption.
Timestamp alone contrast: second level values funnel all devices writing at once onto one partition, guaranteeing heat.
Low cardinality contrast: manufacturer or sensor value repeats across millions of events, collapsing distribution to a few partitions.
Why A is correct
A is correct because concatenating deviceId with timestamp yields near unique values per write batch while preserving queryability by device and time range. High cardinality spreads ingest across many physical partitions, keeping per partition storage and RU usage balanced for one second cadence. It therefore minimizes skew, avoids single partition caps, and prevents hot spots by design.
Why the others are wrong
B. timestamp alone funnels concurrent device writes onto the same partition each second.
C. manufacturer has tiny cardinality and creates massive skewed partitions.
D. sensor value is repetitive and unpredictable, failing distribution and filtering needs.
DP-420 exam tip
For high rate IoT writes, synthesize device plus time to maximize spread and avoid heat.
2You 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?
In a directory container, create a document for each company and a document for each user. Use the company ID as the partition key.
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.
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.
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: D
The short version
D — embed users inside company documents for read heavy browsing. One company partition returns company plus all users together, matching the detail page pattern in the settled key.
Key concepts in this question
Embedding: nesting related child records inside a parent JSON document to serve common access paths in one read.
Read optimization: directory browsing plus detail pages benefit when a single partition lookup returns the full aggregate.
Partition by company: company ID as key colocates each firm and its sub thousand users, keeping detail queries single partition.
Separate containers contrast: splitting users and companies forces cross container joins or multiple round trips for every detail view.
User centric contrast: partitioning by user scatters one company across many partitions, harming browse by company efficiency.
Why D is correct
D is correct because requirements emphasize browsing by company and showing company plus all related users whenever either profile opens. Embedding users under two kilobyte thresholds and bounded counts keeps documents within limits while enabling one read for the whole page. Using company ID as partition key further guarantees that read fans out to exactly one partition.
Why the others are wrong
A. separate documents with shared key still need multiple reads and joins for detail pages.
B. dual containers optimize isolated point lookups, not company scoped browsing with full details.
C. user partitioned embedding inverts locality and scatters company views.
DP-420 exam tip
When detail pages show parent plus children together, embed children and partition by parent.
3You are building an application that will store data in an Azure Cosmos DB Core (SQL) API account. The account uses the session default consistency level. The account is used by five other applications. The account has a single read-write region and 10 additional read region.
Approximately 20 percent of the items stored in the account are updated hourly.
Several users will access the new application from multiple devices.
You need to ensure that the users see the same item values consistently when they browse from the different devices. The solution must NOT affect the other applications.
Which two actions should you perform? Each correct answer presents part of the solution.
NOTE: Each correct selection is worth one point.
Set the default consistency level to eventual
Associate a session token to the device
Use implicit session management when performing read requests
Provide a stored session token when performing read requests
Associate a session token to the user account
Answer: D, E
The short version
DE — scope session consistency to the user without touching account defaults. Storing the token at user level and replaying it on reads gives repeatable views across devices in the settled key.
Key concepts in this question
Session consistency: default Cosmos DB level that guarantees read your writes within a client session tracked by a token.
Session token: opaque version marker returned on writes that must accompany later reads to preserve monotonic visibility.
User versus device binding: attaching the token to the user identity shares progress across phones and browsers, while device binding fragments it.
Explicit replay: providing the stored token on each read request forces replicas to honor that version instead of stale data.
Account default contrast: changing default consistency would affect five other apps, violating the isolation requirement.
Why DE is correct
D is correct because passing the saved session token on read requests directs the service to return data at least as fresh as the token version. E is correct because associating that token with the user account propagates the same version across all of their devices, ensuring identical item values everywhere. Together they deliver cross device consistency while leaving the shared account setting untouched.
Why the others are wrong
A. eventual weakens guarantees and still changes behavior for other applications.
B. device bound tokens isolate sessions per hardware, breaking cross device sameness.
C. implicit management does not share versions across devices without explicit handling.
DP-420 exam tip
For same user same data on many devices, bind token to user and replay it explicitly.
4Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You have an Azure Cosmos DB Core (SQL) API account named account1 that uses autoscale throughput.
You need to run an Azure function when the normalized request units per second for a container in account1 exceeds a specific value.
Solution: You configure Azure Event Grid to send events to the function by using an Event Grid trigger in the function.
Does this meet the goal?
Yes
No
Answer: B
The short version
B — No, Event Grid cannot fire on RU threshold. Normalized RU signals live in metrics and logs, so an Azure Monitor alert with an action group must trigger the function in the settled key.
Key concepts in this question
Normalized RU metric: per container throughput utilization signal that indicates throttling risk when it exceeds one hundred percent.
Azure Monitor alerts: threshold engine over metrics and logs that can invoke action groups including functions, webhooks, and queues.
Event Grid contrast: event routing for control plane and data mutations, not a metrics threshold evaluator for RU consumption.
Autoscale contrast: automatically adjusts RU bounds within policy but does not by itself execute custom code on breach.
Trigger types: function triggers listen to queues, timers, blobs, or HTTP, while Monitor provides the bridge from metric to execution.
Why B is correct
B is correct because configuring Event Grid with a function trigger does not subscribe to normalized RU telemetry or evaluate greater than conditions. The supported pattern creates an Azure Monitor alert rule on the Cosmos DB metric and routes it through an action group to the function endpoint. Since the proposed Event Grid path misses both detection and routing, it fails the goal and the answer is No.
Why the others are wrong
A. Yes would require Event Grid to natively watch RU metrics, which it does not.
DP-420 exam tip
RU threshold automation always means Monitor alert plus action group, never Event Grid alone.
5Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You have an Azure Cosmos DB Core (SQL) API account named account 1 that uses autoscale throughput.
You need to run an Azure function when the normalized request units per second for a container in account1 exceeds a specific value.
Solution: You configure an Azure Monitor alert to trigger the function.
Does this meet the goal?
Yes
No
Answer: A
The short version
A — Yes, an Azure Monitor alert on normalized RU reliably triggers the function. Metric-based alerting watches throughput signals and invokes the action group containing the function app.
Key concepts in this question
Normalized RU per second: the 0 to 100 percent utilization signal showing how close a Cosmos DB container is to its provisioned or autoscale ceiling.
Azure Monitor alerts: metric rules that evaluate signals on a cadence and fire actions when thresholds are breached.
Autoscale throughput: elastic RU scaling where monitoring saturation still matters for notifications and downstream work.
Function action integration: alert action groups can call an Azure function, webhook, logic app or email when the rule fires.
Change-feed contrast: data-change triggers react to document writes, not to throughput saturation signals.
Why A is correct
A is correct because Azure Monitor exposes Cosmos DB normalized RU consumption as an alertable metric. Configuring a metric alert with a threshold plus an action group targeting the function meets the need to run code when utilization exceeds a value. This is the documented observability path for RU-based automation on autoscale accounts.
Why the others are wrong
B. No is wrong because metric alerts plus action groups are a supported mechanism for RU-threshold function invocation.
DP-420 exam tip
For DP-420, map RU threshold plus run function to Azure Monitor metric alerts, and map document changes to change feed.
6Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You have an Azure Cosmos DB Core (SQL) API account named account 1 that uses autoscale throughput.
You need to run an Azure function when the normalized request units per second for a container in account1 exceeds a specific value.
Solution: You configure the function to have an Azure CosmosDB trigger.
Does this meet the goal?
Yes
No
Answer: B
The short version
B — No, a Cosmos DB trigger fires on document changes, not RU pressure. It listens to the change feed for inserts and updates and cannot detect normalized throughput saturation.
Key concepts in this question
Cosmos DB trigger for Functions: a change-feed-powered binding that starts function executions when documents are created or modified.
Normalized RU metric: a performance signal emitted to Azure Monitor, evaluated by alert rules rather than data-plane triggers.
Autoscale account behavior: throughput scales within bounds while data changes flow independently through the change feed.
Threshold automation need: running code because utilization passed a value is an observability task, not a data-change task.
Series-question logic: this variant replaces alerting with a data trigger, which addresses the wrong signal.
Why B is correct
B is correct because the Cosmos DB trigger source is the container change feed, so it activates only when documents change. It has no input for normalized RU per second and no threshold evaluation for throughput. Using it would run the function on writes even when RU is healthy and miss RU spikes with no writes, so it does not meet the goal.
Why the others are wrong
A. Yes is wrong because a change-feed trigger cannot observe or compare RU consumption against a specific value.
DP-420 exam tip
Never choose Cosmos DB trigger for RU or metric goals on DP-420; reserve it for document insert and update handling.
7Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.
You have an Azure Cosmos DB Core (SQL) API account named account 1 that uses autoscale throughput.
You need to run an Azure function when the normalized request units per second for a container in account1 exceeds a specific value.
Solution: You configure an application to use the change feed processor to read the change feed and you configure the application to trigger the function.
Does this meet the goal?
Yes
No
Answer: B
The short version
B — No, change-feed processor code reacts to data changes, not RU saturation. Reading the feed to trigger a function still keys off document operations rather than normalized throughput.
Key concepts in this question
Change feed processor: a client library that distributes and checkpoints document-change batches for scalable consumption.
Normalized RU signal: a Monitor metric reflecting throughput pressure, independent of whether any single change batch is large.
Custom application trigger path: wiring feed batches to invoke a function adds hops but does not create RU awareness.
Autoscale monitoring gap: high RU can occur from queries and retries without proportional change-feed volume.
Correct RU path: metric alert rules evaluate utilization and invoke functions through action groups.
Why B is correct
B is correct because the proposed application still sources events from the change feed, which contains inserts and updates rather than RU measurements. No RU threshold comparison occurs in feed processing, so the function would fire on data activity instead of on exceeding the throughput value. The solution therefore misses the stated metric-driven goal.
Why the others are wrong
A. Yes is wrong because adding a processor plus function call does not convert a data-change stream into an RU-threshold detector.
DP-420 exam tip
On DP-420, change feed always means data changes; for RU or saturation wording, switch to Monitor alerts.
8You have a database named db1 in an Azure Cosmos DB Core (SQL) API account.
You are designing an application that will use db1.
In db1, you are creating a new container named coll1 that will store online orders.
The following is a sample of a document that will be stored in coll1. The application will have the following characteristics:
✑ New orders will be created frequently by different customers.
✑ Customers will often view their past order history.
You need to select the partition key value for coll1 to support the application. The solution must minimize costs.
To what should you set the partition key?
orderId
customerId
orderDate
id
Answer: B
The short version
B — customerId is the cost-effective partition key for order history. Grouping orders by customer colocates the frequent access pattern and spreads writes across many logical partitions.
Key concepts in this question
Partition key design: choosing a high-cardinality property that matches dominant queries while distributing RU and storage evenly.
customerId cardinality: thousands or millions of distinct customers, giving balanced partition sizes and avoiding hot spots.
orderId and id uniqueness: per-document values that scatter each customer history read across all partitions, raising RU cost.
orderDate time bucketing: concentrates daily writes in one partition and forces cross-partition reads for customer history.
Cost minimization goal: favoring single-partition targeted reads for the most common query over narrow write locality.
Why B is correct
B is correct because the application writes new orders from many customers while frequently reading one customer past history. Partitioning by customerId makes each history query a single-partition lookup and distributes new-order writes across customers. That combination minimizes RU consumption and avoids the hot-partition plus fan-out penalties of the alternatives.
Why the others are wrong
A. orderId creates one partition per order, so every customer-history read fans out across partitions at high RU cost.
C. orderDate piles concurrent writes into the current date partition and scatters each customer read across dates.
D. id is likewise unique per document, giving the same scatter penalty as orderId for history queries.
DP-420 exam tip
For DP-420 orders, default to customerId when reads are per-customer history and writes come from many customers.
9You have a container in an Azure Cosmos DB Core (SQL) API account that stores data about orders.
The following is a sample of an order document. Documents are up to 2 KB.
You plan to receive one million orders daily.
Customers will frequently view their past order history.
You are the evaluating whether to use orderDate as the partition key.
What are two effects of using orderDate as the partition key? Each correct answer presents a complete solution.
NOTE: Each correct selection is worth one point.
You will exceed the maximum number of partition key values
You will exceed the maximum storage per partition
There will always be a hot partition
Queries will run cross-partition
Answer: C, D
The short version
CD — A date key creates a perpetual hot partition plus cross-partition history reads. Daily writes concentrate on one value while per-customer queries must scan every date.
Key concepts in this question
Hot partition: a single logical partition absorbing disproportionate throughput, throttling autoscale efficiency and raising latency.
Cross-partition query: a fan-out read touching many physical partitions, consuming far more RU than a targeted single-partition read.
One million daily orders: high ingest volume that magnifies any imbalance in the partition-key choice.
2 KB documents: small payloads where RU cost is dominated by partition targeting rather than document size.
Customer-history pattern: the frequent query filters by customer, which a date key does not colocate.
Why CD is correct
CD is correct because orderDate funnels all of one day writes to the same logical partition, guaranteeing a hot partition during peak ingest. Meanwhile customer-history reads lack the partition key in their filter, so they must fan out across all date partitions. Those twin effects raise throttling risk and RU charges together, matching the settled pair.
Why the others are wrong
A. The number of date values is unbounded over time, so exceeding the maximum count of partition key values does not occur.
B. Daily storage for 2 KB times one million orders stays well below per-partition storage ceilings, so capacity is not the effect.
DP-420 exam tip
On DP-420, time keys mean hot writes plus fan-out reads; customer keys mean balanced writes plus targeted reads.
10You have a container in an Azure Cosmos DB Core (SQL) API account. The container stores data about families. Data about parents, children, and pets are stored as separate documents.
Each document contains the address of each family. Members of the same family share the same partition key named familyId.
You need to update the address for each member of the same family that share the same address. The solution must meet the following requirements:
✑ Be atomic, consistent, isolated, and durable (ACID).
✑ Provide the lowest latency.
What should you do?
Update the document of each family member separately by using a patch operation
Update the document of each family member separately and set the consistency level to strong
Update the document of each family member by using a transactional batch operation
Answer: C
The short version
C — Transactional batch gives ACID multi-document updates in one partition. Same-family documents sharing familyId can be committed atomically with the lowest round-trip latency.
Key concepts in this question
TransactionalBatch: a Cosmos DB Core API operation grouping creates, replaces, upserts and deletes for items with one partition key.
Same-partition scope: family members sharing familyId satisfy the batch requirement that all operations target one logical partition.
ACID need: address changes across parents, children and pets must all succeed or all roll back together.
Separate patch operations: individual writes that lack atomicity across documents and add sequential latency.
Consistency level contrast: strong consistency affects read freshness and ordering, not atomic commit across documents.
Why C is correct
C is correct because transactional batch executes all family address updates as a single atomic unit isolated to the familyId partition. It provides snapshot isolation and automatic rollback on failure while completing in one server round trip. That delivers both the ACID guarantee and the lowest latency among the options for same-partition family data.
Why the others are wrong
A. Separate patch operations per member require multiple trips and can partially succeed, breaking atomicity.
B. Separate writes with strong consistency still commit independently, so atomicity is missing and latency stays higher.
DP-420 exam tip
For DP-420 same-partition multi-document ACID needs, choose transactional batch; reserve patch for single-document edits.