Designing and Implementing Cloud-Native Applications Using Microsoft Azure Cosmos DB (DP-420) Exam-style mock test
Azure Cosmos DB Developer (DP-420) Practice Exams|Practice test
Full explanations
Exam format
Pass line 70%
33 USD One-time · lifetime access
Enroll →
Sample questions
Example1 · Cosmos DB Core Concepts & Data Modeling
A B2B SaaS invoicing platform stores invoice documents in an Azure Cosmos DB for NoSQL container. Nearly all read and write operations retrieve invoices for one tenant at a time, and the largest tenant generates roughly 2% of total traffic. Which property should the team select as the partition key to balance load while keeping common queries single-partition?
・The invoiceStatus property, because grouping invoices by their lifecycle state keeps related documents physically together for status dashboards
Incorrect. invoiceStatus has very low cardinality (a handful of states), so writes concentrate on a few partitions and most tenant-scoped queries would still fan out across partitions.
✓The tenantId property, because it has high cardinality across tenants and scopes most queries to a single logical partition without creating a hot partition
Correct. tenantId offers high cardinality and aligns with the tenant-scoped access pattern, so queries stay single-partition while no single tenant dominates throughput enough to create a hot partition.
・The createdDate property, because ordering invoices chronologically distributes writes evenly across all physical partitions over time
Incorrect. createdDate concentrates all current writes on the partition for 'today', producing a hot partition for inserts even though reads span many partitions.
・The region property, because tenants are grouped geographically and that keeps each region's data within one physical partition for locality
Incorrect. region typically has low cardinality and clusters many tenants together, producing large, unevenly loaded partitions and cross-tenant fan-out for queries.
Explanation
A good partition key has high cardinality, spreads request volume evenly, and matches the dominant query filter. tenantId satisfies all three for a tenant-scoped SaaS workload.
Example2 · Partitioning, Throughput & Consistency
A B2B SaaS invoicing platform stores millions of invoice documents in an Azure Cosmos DB for NoSQL container. Nearly all read and write queries filter by the tenant's organization, and tenants are many and roughly balanced in size. Which property should the team select as the partition key to achieve even distribution and efficient queries?
✓The organizationId, because queries filter by tenant and the many balanced tenants spread requests evenly
Correct. organizationId has high cardinality and is used in nearly all queries, giving even distribution and in-partition query routing.
・The invoiceStatus field, since filtering invoices by their current processing status is a very common operation
Incorrect. invoiceStatus has very low cardinality, creating a few huge logical partitions and severe hot partitions.
・The createdDate timestamp, because new invoices are written in order and recent data is queried most often
Incorrect. A date-based key concentrates all current writes into the newest partition, producing a hot partition on ingest.
・The country code of each organization, since grouping invoices by geographic region simplifies regional reporting
Incorrect. Country code has low cardinality and skews toward a handful of large markets, causing imbalance and hot partitions.
Explanation
A good partition key has high cardinality and matches the dominant query filter; organizationId satisfies both for a balanced multi-tenant workload.
Example3 · NoSQL API: Queries & SDK Operations
A B2B SaaS company stores tenant invoice documents in an Azure Cosmos DB for NoSQL container. Each document has a nested object named billing with city and country fields. An analyst needs a query that returns only the invoice id and the billing city, renaming the city field to location in the result set. Which SELECT clause produces this output correctly?
✓SELECT c.id, c.billing.city AS location FROM c
Correct. The AS keyword aliases the projected c.billing.city property to location, and dotted navigation reaches the nested field.
・SELECT c.id, c.billing.city FROM c WHERE location = c.billing.city
Incorrect. The projection does not rename the field, and location is not a valid filter reference because no such property exists on the document.
・SELECT c.id, location = c.billing.city FROM c GROUP BY location
Incorrect. Assignment syntax is not how aliasing works in the NoSQL query language, and GROUP BY would collapse rows unexpectedly here.
・SELECT c.id, c.billing['city'] FROM c RENAME city TO location
Incorrect. There is no RENAME clause in the Cosmos DB NoSQL query language, so this statement is invalid syntax.
Explanation
Aliasing a projected property in Azure Cosmos DB for NoSQL uses the AS keyword, and nested fields are reached with dotted or bracket navigation.
Example4 · Indexing, Change Feed & Stored Procedures
A healthcare services firm ingests high-volume telemetry from patient wearables into a write-heavy Cosmos DB container, and queries are run later from a separate analytical container. The team wants to minimize RU charges on every write to the ingestion container. Which indexing policy change should they apply to that container?
✓Set the indexing mode to none so that no properties are indexed and write operations no longer incur indexing RU overhead
Correct. Setting indexing mode to none disables automatic indexing, so write operations incur no indexing RU overhead, which suits a write-heavy ingestion container not queried directly.
・Keep consistent indexing mode but reduce the consistency level of the database account to eventual for cheaper writes
Incorrect. Account consistency level affects read guarantees and replication, not the per-write indexing RU charge, so it does not address the goal.
・Switch the indexing mode to lazy so that the index is updated during idle periods after writes return
Incorrect. Lazy indexing mode has been deprecated in Azure Cosmos DB and is no longer an available option for new policies.
・Set the indexing mode to consistent while excluding only the partition key path from the included paths list
Incorrect. The partition key path does not need to be in included paths to be usable, and excluding one path still leaves most writes incurring indexing cost.
Explanation
For a write-heavy container whose data is queried elsewhere, indexing mode none removes indexing RU overhead on writes. Lazy mode is deprecated and account consistency is unrelated to indexing cost.
Example5 · Monitoring, Security & Global Distribution
A healthcare services firm needs to retain detailed request-level telemetry from its Cosmos DB account so that operations can analyze query patterns and throttled requests using Kusto queries months later. Which configuration meets this need?
・Rely on the built-in metrics blade in the Azure portal, which already stores per-request data indefinitely for every account
Incorrect. The portal metrics blade shows aggregated platform metrics with limited retention and does not expose per-request Kusto-queryable logs over many months.
✓Create a diagnostic setting that sends the DataPlaneRequests category to a Log Analytics workspace for later Kusto analysis
Correct. A diagnostic setting routing the DataPlaneRequests log category to Log Analytics captures request-level telemetry that can be queried with Kusto for long-term analysis.
・Enable the Insights workbook and export the aggregated charts to a storage account every night
Incorrect. The Insights workbook visualizes aggregated metrics and does not persist queryable per-request log records for later Kusto analysis.
・Turn on the Cosmos DB metric alerts feature and route the alert payloads into a Log Analytics workspace
Incorrect. Metric alerts fire on threshold conditions and their payloads are not a substitute for capturing the full DataPlaneRequests log stream.
Explanation
Request-level diagnostics such as DataPlaneRequests must be emitted through a diagnostic setting to a Log Analytics workspace where they can be queried with Kusto and retained per workspace policy.
Example6 · Cosmos DB Core Concepts & Data Modeling
A healthcare services firm stores millions of patient visit records in an Azure Cosmos DB for NoSQL container. Most queries filter visits by a single patient and the firm wants storage and request units spread evenly across physical partitions. Which property should be selected as the partition key?
・The visitDate field, because ordering records chronologically keeps related visits together in one logical partition for faster scans
Incorrect. Date-based keys concentrate current writes on one logical partition, creating a hot partition and uneven request unit distribution over time.
✓The patientId field, because it has high cardinality and most queries filter by patient, giving even distribution and in-partition reads
Correct. patientId has high cardinality and matches the dominant query filter, so it spreads data evenly while keeping patient reads single-partition and efficient.
・The clinicRegion field, so that records are grouped by one of only four regional offices the firm currently operates in
Incorrect. Only four regions yields very low cardinality, forcing enormous logical partitions and skewed throughput that cannot scale well.
・The recordType field, which contains the value visit for every document stored in this particular container collection
Incorrect. A field holding the same value for every document gives a single logical partition, defeating horizontal scale entirely.
Explanation
A good partition key has high cardinality, distributes requests and storage evenly, and aligns with the most frequent query filter; patientId satisfies all three.
Example7 · Cosmos DB Core Concepts & Data Modeling
A retail chain, UrbanThread, stores shopping-cart items in an Azure Cosmos DB for NoSQL container. Almost every query filters carts by the shopper who owns them, and each shopper has only a handful of active carts. Which property should the team select as the partition key to balance storage and distribute request load evenly?
✓The shopperId property, because it appears in nearly every query filter and spreads items across many shoppers
Correct. shopperId has high cardinality and matches the dominant query filter, so it distributes both storage and throughput evenly while keeping cart reads to a single partition.
・The orderStatus property, which holds one of three fixed values such as open, abandoned, or completed
Incorrect. orderStatus has only three values, creating a few very large logical partitions and severe skew in both storage and request units.
・The storeRegion property, which groups all carts for shoppers into one of four large geographic regions
Incorrect. storeRegion has low cardinality with only four values, so a handful of partitions would absorb most traffic and risk hot partitions.
・The createdDate property, because recent carts are read most often and older carts are rarely touched
Incorrect. createdDate concentrates all new writes onto the most recent value, producing a hot partition for inserts despite spreading older data.
Explanation
A good partition key has high cardinality and aligns with the most common query filter so that both data volume and request units distribute evenly and most queries stay within one partition.
Example8 · Cosmos DB Core Concepts & Data Modeling
UrbanThread's platform team is reviewing how Azure Cosmos DB organizes their product-catalog container. A new engineer asks how logical partitions relate to physical partitions as the container grows. Which statement correctly describes the relationship?
・Each logical partition is pinned to its own dedicated physical partition, so the two counts always match exactly
Incorrect. A physical partition commonly hosts many logical partitions, so the counts do not match one to one.
✓Logical partitions are grouped by partition key value, and Azure Cosmos DB maps one or more of them onto each physical partition behind the scenes
Correct. Items sharing a partition key value form a logical partition, and the service transparently places one or more logical partitions on each physical partition and splits them as data grows.
・Physical partitions are created manually by administrators, while logical partitions form automatically from each item's id field alone
Incorrect. Physical partitions are managed automatically by the service, not created by administrators, and logical partitions are defined by the partition key, not the id alone.
・Logical partitions store index metadata only, while all document data is kept together inside a single shared physical partition
Incorrect. Logical partitions hold the actual items grouped by key value, and document data is spread across multiple physical partitions as the container scales.
Explanation
Logical partitions are defined by partition key value and hold the items; Azure Cosmos DB automatically distributes those logical partitions across physical partitions and splits them as storage and throughput grow.
Example9 · Cosmos DB Core Concepts & Data Modeling
UrbanThread models customer orders in Azure Cosmos DB for NoSQL. Each order has a small, fixed set of line items that are always read and written together with the order and never queried on their own. Which modeling choice best fits this access pattern?
・Store each line item as a separate document referencing the order id, then join them at read time in the application
Incorrect. Referencing separate documents forces application-side joins and extra reads for data that is always accessed together.
✓Embed the line items as an array inside the order document so they are retrieved and updated in a single operation
Correct. Embedding the bounded, always-together line items in the order document gives single-request reads and atomic updates, which suits this access pattern.
・Keep line items in a relational database and leave only order summary fields inside the Cosmos DB order document for lookups
Incorrect. Splitting the data into a relational store adds cross-system complexity with no benefit when the items are small and read together.
・Create a dedicated line-items container partitioned by product, and query it independently whenever an order is opened
Incorrect. A separate line-items container partitioned by product spreads one order's items across partitions and adds unnecessary cross-partition reads.
Explanation
Embedding is preferred when related data is bounded in size and always accessed together, enabling single-request retrieval and atomic updates within one document.
Example10 · Cosmos DB Core Concepts & Data Modeling
A financial services company is migrating a fraud-detection service that stores JSON transaction records and queries them with ad-hoc SQL-style filters. The team wants a new Azure Cosmos DB account optimized for this document workload with the richest native query language. Which API should they select?
・API for MongoDB, because it offers full wire-protocol compatibility with existing MongoDB drivers used by the legacy tooling layer
Incorrect. The API for MongoDB targets teams already standardized on the MongoDB wire protocol, not those wanting the native Cosmos DB SQL query language over JSON.
✓API for NoSQL, because it stores JSON documents and supports the Cosmos DB SQL query language over those items
Correct. The API for NoSQL natively stores JSON items and exposes the Cosmos DB SQL query language, making it the best fit for a document workload needing rich ad-hoc queries.
・API for Table, because it provides a premium key-value store with automatic secondary indexing on all properties
Incorrect. The API for Table is a key-value store that lacks the rich SQL document query surface this fraud-detection workload requires.
・API for Apache Gremlin, because it models the transactions as a property graph with vertices, edges, and traversals
Incorrect. The API for Apache Gremlin is for graph traversal scenarios, which does not match a document query workload over transaction JSON.
Explanation
The API for NoSQL is the native document API and the only one that offers the full Cosmos DB SQL query language over JSON items.
Example11 · Cosmos DB Core Concepts & Data Modeling
A bank's payments container holds 500 million transaction items spread across millions of customer accounts, and the dominant access pattern reads all transactions for one account. Which partition key choice best balances storage and throughput while keeping the common query single-partition?
・Use transactionStatus, because grouping by a small set of status values keeps related items physically together for fast reads
Incorrect. transactionStatus has very low cardinality, creating a few large hot partitions rather than an even distribution.
・Use transactionDate, because chronological grouping aligns writes with the current date and simplifies time-range reporting
Incorrect. transactionDate funnels all current writes into one partition, producing a hot partition on the latest date.
✓Use accountId, because it has high cardinality and matches the dominant single-account read access pattern
Correct. accountId has high cardinality for even distribution and scopes the dominant read to a single logical partition.
・Use region, because partitioning by the handful of operating regions keeps each physical partition aligned to a data-residency boundary
Incorrect. region has only a handful of values, so throughput and storage concentrate into a few oversized partitions.
Explanation
A high-cardinality key that matches the common query (accountId) spreads load evenly and keeps the frequent read single-partition.
Example12 · Cosmos DB Core Concepts & Data Modeling
A manufacturing distributor stores millions of order-line records in a Cosmos DB for NoSQL container. Nearly all read and write operations retrieve the lines for one specific sales order at a time, and the order volume is spread evenly across thousands of orders per day. Which property should be selected as the partition key to give the best balance of even distribution and efficient queries?
・The warehouseRegion property, so that all records handled by one regional distribution center are co-located together within a single logical partition for reporting
Incorrect. warehouseRegion is low-cardinality, so a handful of regions would concentrate traffic into a few hot partitions and risk exceeding the logical partition size limit.
✓The orderId property, because it is high-cardinality and matches the field used to filter the vast majority of point reads and writes
Correct. orderId has high cardinality and is the field used to filter almost every operation, so it spreads load evenly and keeps the common query a single-partition read.
・The productCategory property, grouping all line items that belong to the same broad category of manufactured goods under one key
Incorrect. productCategory has few distinct values, creating large skewed logical partitions and forcing cross-partition queries for order-based access.
・The orderStatus property, which lets the application quickly scan every line that currently shares the same processing state value
Incorrect. orderStatus has very few values and changes over time, producing severe skew and hot partitions as records cluster on a shared status.
Explanation
An effective partition key combines high cardinality with alignment to the most frequent query filter. orderId satisfies both, while region, category, and status are all low-cardinality and would create hot partitions.
Example13 · Cosmos DB Core Concepts & Data Modeling
A distributor's product catalog document includes a list of supplier contacts. Each supplier can appear on thousands of different products, supplier phone numbers change frequently, and contact details are updated far more often than the products themselves are read. Which data modeling approach best fits this relationship?
・Embed the full supplier contact object inside every product document so each product read returns all supplier details in a single request without extra lookups
Incorrect. Embedding a frequently-changing supplier across thousands of products forces many write updates for every detail change, which is costly and error-prone.
✓Reference suppliers by id from the product documents and keep supplier details in a separate container that is read only when needed
Correct. Referencing keeps the volatile, highly-shared supplier data in one place, so a single update maintains consistency without rewriting thousands of products.
・Duplicate the supplier contact into each product and additionally store a materialized copy in a dedicated supplier summary document for reporting
Incorrect. Duplicating into every product and a summary document multiplies write amplification and still requires updating many copies on each change.
・Store suppliers and products together in one shared document keyed by region so related data is always retrieved in a single partition
Incorrect. Combining unrelated high-volume entities into one region-keyed document creates oversized documents and does not address the frequent supplier updates.
Explanation
When related data changes frequently and is shared across many parents, referencing avoids write amplification and keeps updates consistent, which is the opposite of the embedding guidance used for bounded, stable, read-together data.
Example14 · Cosmos DB Core Concepts & Data Modeling
A telecom operator stores call detail records (CDRs) in an Azure Cosmos DB for NoSQL container. Nearly all queries filter by the subscriber phone number, and the data grows past 500 GB with billions of records. Which partition key should the operator choose to avoid hot partitions and keep queries efficient?
・Use the record ingestion date so that records are grouped by day, which keeps related records physically close for daily batch reporting jobs
Incorrect. Date-based keys concentrate all current writes on one partition each day, creating a hot partition and uneven storage over time.
✓Use the subscriber phone number, which has high cardinality and matches the dominant query filter for even distribution
Correct. The subscriber phone number has high cardinality and matches the dominant filter, spreading load evenly and enabling single-partition queries.
・Use the call type enumeration such as voice, SMS, or data, which naturally classifies every record into one of a few logical buckets
Incorrect. Call type has only a handful of distinct values, producing very large logical partitions that quickly exceed storage and throughput limits.
・Use the originating cell tower identifier because most calls route through a limited and well-known set of regional towers
Incorrect. Tower identifiers skew heavily toward busy towers, so a few logical partitions absorb most records and become hot partitions.
Explanation
A good partition key has high cardinality, distributes requests evenly, and aligns with the most frequent query filter. The subscriber phone number satisfies all three for this CDR workload.
Example15 · Cosmos DB Core Concepts & Data Modeling
A telecom operator's architect is explaining Azure Cosmos DB internals to the billing team. Which statement correctly describes the relationship between logical and physical partitions in a container?
✓Each distinct partition key value maps to one logical partition, and the service transparently maps many logical partitions onto physical partitions it manages
Correct. Each unique partition key value forms a logical partition, and Cosmos DB automatically distributes many logical partitions across the physical partitions it manages.
・Each physical partition corresponds to exactly one logical partition, so the number of physical partitions always equals the count of distinct partition key values present
Incorrect. A physical partition hosts many logical partitions; there is no one-to-one mapping between physical partitions and distinct key values.
・Logical partitions are defined by the developer at container creation time, while physical partitions must be sized and provisioned manually before any data is written
Incorrect. Physical partitions are managed and scaled automatically by the service and are never provisioned manually by the developer.
・A logical partition can grow without bound as long as the container has autoscale throughput enabled on it and sufficient regional replicas configured
Incorrect. A single logical partition is capped at 20 GB regardless of throughput mode or replica configuration.
Explanation
Cosmos DB groups items sharing a partition key value into a logical partition (max 20 GB) and automatically places many logical partitions onto service-managed physical partitions.
▶ Try 10 free questions (graded)