DP-420 study materials
DP-420 study resources

DP-420 practice questions

One question at a time. Build your DP-420 understanding.

First 50 of 200 questions. Each one lists the choices, the correct answer, and an explanation. The checker at the top of this page saves progress in this browser when it is available.

Continue in the practice tool above to load more questions, 50 at a time.

Question 1Design and develop database solutions

A container is approaching the 20 GB limit for a single logical partition. You plan to define a hierarchical partition key. What is the maximum number of levels a hierarchical partition key can contain?

  1. Two levels
  2. Three levels Correct answer.
  3. Four levels
  4. Ten levels

Explanation

A hierarchical partition key supports up to three levels, for example /tenantId/userId/sessionId. The combination of the levels defines the logical partition key, and the 20 GB limit applies to those combined values rather than to each level.

Question 2Design and develop database solutions

Which consistency level does a newly created Azure Cosmos DB for NoSQL account use by default?

  1. Strong
  2. Bounded staleness
  3. Session Correct answer.
  4. Eventual

Explanation

Session consistency is the default for new accounts. It guarantees consistent prefix, monotonic reads and writes, and read-your-own-writes for a client that holds the session token, while still allowing low-latency reads from local replicas.

Question 3Design and develop database solutions

You are selecting the partition key for a container that will store millions of order documents and must handle high write throughput. Which property makes the best partition key?

  1. A string data type so it sorts predictably
  2. A value that matches the document's id property
  3. A value that is covered by the default range index
  4. High cardinality and even distribution Correct answer.

Explanation

Throughput and storage are divided across physical partitions, so the partition key must have many distinct values that are accessed at similar rates. High cardinality with even access avoids hot partitions, while data type and indexing have no bearing on distribution.

Question 4Design and develop database solutions

Which statement about a serverless-capacity Azure Cosmos DB for NoSQL account is correct?

  1. It requires a minimum of 400 RU/s per container.
  2. It guarantees a fixed throughput ceiling per database.
  3. It supports multiple write regions.
  4. It bills only for the request units consumed. Correct answer.

Explanation

Serverless accounts are billed per request unit consumed and per GB of storage, with no minimum throughput to provision. They are limited to a single write region and are intended for workloads with intermittent or unpredictable traffic.

Question 5Design and develop database solutions

An autoscale container is configured with a maximum throughput of 10,000 RU/s. To what value can the container scale down when the workload is idle?

  1. 10,000 RU/s
  2. 1,000 RU/s Correct answer.
  3. 100 RU/s
  4. 4,000 RU/s

Explanation

Autoscale scales between the configured maximum and one tenth of that maximum. For a 10,000 RU/s maximum, the floor is therefore 1,000 RU/s, and billing follows the throughput actually used during each hour.

Question 6Design and develop database solutions

An application performs a point read by using an item's id and partition key value. The item is 1 KB. With session consistency, approximately how many request units does the read consume?

  1. 0.5 RU
  2. 10 RU
  3. 1 RU Correct answer.
  4. 5 RU

Explanation

A point read of a 1 KB item by id and partition key costs about 1 RU. Point reads are the cheapest read pattern, and the cost scales roughly linearly with item size.

Question 7Design and develop database solutions

Time to live is enabled on a container with the default time to live set to -1, and no items define their own time-to-live value. What happens to the items in the container?

  1. They are deleted when the container is next read.
  2. They are deleted 24 hours after creation.
  3. They expire one second after creation.
  4. They never expire. Correct answer.

Explanation

A default time to live of -1 means time to live is enabled but no default expiration is set, so items persist indefinitely unless they are overwritten or deleted. An item can still opt in to expiration by setting its own time-to-live property to a positive number.

Question 8Design and develop database solutions

You need to store highly connected data such as social relationships and query it by using multi-hop traversals. Which Azure Cosmos DB API should you choose?

  1. API for Gremlin Correct answer.
  2. API for MongoDB
  3. API for Cassandra
  4. API for Table

Explanation

The API for Gremlin stores data as vertices and edges and supports graph traversal queries. The other APIs are document, key-value, or wide-column oriented and do not provide native traversal semantics.

Question 9Design and develop database solutions

A document has at most 20 line items, and the application always retrieves an order together with all of its line items. How should you model the line items?

  1. Store them in a separate container with a shared partition key
  2. Store them in a separate container keyed by order id
  3. Store each line item in its own container
  4. Embed them as an array in the order document Correct answer.

Explanation

When the child set is bounded and is always read with the parent, embedding keeps the data in one item so a single point read returns everything. Referencing would add extra round trips and request unit cost for no benefit.

Question 10Design and develop database solutions

What determines the number of physical partitions that an Azure Cosmos DB for NoSQL container uses?

  1. The consistency level of the account
  2. The number of distinct partition key values
  3. The data size and provisioned throughput Correct answer.
  4. The number of indexed properties

Explanation

The service creates physical partitions based on the total storage consumed and the provisioned request units, since each physical partition has limits for both. The number of distinct logical partition key values does not directly set the physical partition count.

Question 11Design and develop database solutions

Which consistency level cannot be used when an Azure Cosmos DB account is configured for multiple write regions?

  1. Session
  2. Strong Correct answer.
  3. Consistent prefix
  4. Eventual

Explanation

Strong consistency requires all replicas to acknowledge a write before it is committed, which depends on a single write region. Once multiple regions accept writes, strong and bounded staleness are no longer available.

Question 12Design and develop database solutions

Which consistency level limits staleness by specifying both a maximum number of versions (K) and a maximum time interval (T)?

  1. Session
  2. Eventual
  3. Consistent prefix
  4. Bounded staleness Correct answer.

Explanation

Bounded staleness guarantees that reads lag behind writes by at most K versions or T time units, whichever is reached first. Eventual and consistent prefix provide ordering guarantees but no staleness bound, and session scopes its guarantee to a single client session.

Question 13Design and develop database solutions

A container uses the default indexing policy, but queries touch only three properties. Which change reduces the request unit charge for writes?

  1. Keep automatic indexing enabled and add a range index on id
  2. Add a composite index for the three properties
  3. Exclude all paths except the three properties Correct answer.
  4. Set the indexing mode to none

Explanation

Every indexed path adds overhead to each write, so restricting the policy to the paths that are actually queried lowers the write cost. Turning indexing off entirely would also reduce writes but would break the queries, so scoping the policy is the correct approach.

Question 14Design and develop database solutions

A query uses ORDER BY c.lastName, c.firstName. What must you add to the indexing policy for the query to be served efficiently?

  1. A unique key on lastName
  2. A range index on the id property
  3. A composite index on lastName and firstName Correct answer.
  4. A spatial index on both properties

Explanation

Ordering by multiple properties requires a composite index that lists the properties in the same order used by the ORDER BY clause, with matching sort directions. A composite index lets the query engine avoid an in-memory sort that would otherwise increase request unit cost.

Question 15Design and develop database solutions

An item's partition key value must change. What must the application do?

  1. Patch the partition key property in place
  2. Replace the item with the new property value
  3. Delete the item and insert a new one with the new value Correct answer.
  4. Wait for Cosmos DB to re-partition the item automatically

Explanation

The partition key value determines the item's logical partition and cannot be modified after the item is created. Changing it requires deleting the existing item and creating a new one, which also means the operation is not a single atomic transaction.

Question 16Design and develop database solutions

A container uses /deviceId as its partition key, but one device produces most of the data in the container. Which approach improves distribution?

  1. Increase the provisioned throughput of the container
  2. Add a time-to-live value to the documents of the busiest device
  3. Use a synthetic key that appends a suffix such as a hash or date to the device id Correct answer.
  4. Enable multiple write regions on the account

Explanation

A synthetic key combines the natural key with an additional value so that one heavily used entity is spread across several logical partitions. This removes the hot partition while keeping the original device id as a queryable property.

Question 17Design and develop database solutions

An application must update five documents atomically in Azure Cosmos DB for NoSQL. What is required for a transactional batch?

  1. All five documents must use identical time-to-live values.
  2. The container must be configured with strong consistency.
  3. All five documents must share the same logical partition key. Correct answer.
  4. Each document must be written by the same client session token.

Explanation

A transactional batch is scoped to a single logical partition key and runs as an all-or-nothing operation with a maximum of 100 operations. Documents in different logical partitions cannot be included in one batch.

Question 18Design and develop database solutions

Which operations are captured by the change feed of an Azure Cosmos DB for NoSQL container by default?

  1. Creates and updates only Correct answer.
  2. Creates only
  3. Deletes only
  4. Creates, updates, and deletes

Explanation

In the default latest-version mode, the change feed records inserts and updates in the order in which they occurred. Deletes are not included unless the container uses the all-versions-and-deletes mode.

Question 19Design and develop database solutions

A database is provisioned with shared throughput. Which statement about its containers is correct?

  1. All containers in the database share the request units. Correct answer.
  2. Only containers smaller than 10 GB can be created in it.
  3. Shared throughput requires serverless capacity.
  4. Each container receives its own dedicated request units.

Explanation

With database-level throughput, the provisioned request units are pooled and consumed by all containers in that database. This is economical for many containers with spiky or low usage, but one busy container can starve the others.

Question 20Design and develop database solutions

How does session consistency let a client read its own writes when reads may be served by a different replica?

  1. By passing the session token with requests Correct answer.
  2. By always reading from the primary replica
  3. By comparing the item's _etag value
  4. By writing to every replica before acknowledging

Explanation

Each write produces a session token that the client SDK attaches to subsequent reads from the same session. A replica that is behind the token waits or defers, which preserves read-your-own-writes without forcing all clients to read from a single replica.

Question 21Design and develop database solutions

A container uses a hierarchical partition key with the levels /tenantId, /userId, and /sessionId. A query supplies equality filters for tenantId and userId only. How is the query executed?

  1. It fans out to every logical partition in the container
  2. It targets only logical partitions that match the prefix Correct answer.
  3. It runs against one logical partition chosen by the gateway
  4. It is rejected because all three levels must be supplied

Explanation

Hierarchical partition keys allow a query to be scoped by any leading prefix of the key. Supplying the first two levels restricts the query to the logical partitions under that prefix, which costs far less than a full fan-out but still spans more than one logical partition.

Question 22Design and develop database solutions

Which conflict resolution modes can be configured for a container in an account that uses multiple write regions?

  1. A custom stored procedure or a merge procedure
  2. Last writer wins or a custom stored procedure Correct answer.
  3. Any of the five consistency-based conflict policies
  4. Last writer wins only

Explanation

Azure Cosmos DB provides two conflict resolution options: last writer wins, which uses a nominated path such as _ts, and a custom stored procedure that implements application-specific merge logic. Merge procedures and consistency-based policies are not valid conflict resolution modes.

Question 23Design and develop database solutions

Two clients update the same item concurrently, and the second update must fail rather than overwrite the first. Which item property should the client send in the If-Match header?

  1. _ts
  2. id
  3. _rid
  4. _etag Correct answer.

Explanation

Optimistic concurrency in Azure Cosmos DB uses the item's _etag, which changes on every write. If the item has been modified since it was read, the conditional request fails with a precondition failure that the application can retry.

Question 24Design and develop database solutions

You modify the indexing policy of an existing container to include an additional path. What is the result?

  1. The index is rebuilt asynchronously while queries keep running. Correct answer.
  2. The container is recreated and the data is copied.
  3. The change is rejected because indexing policies are immutable.
  4. The change applies only to items written afterwards.

Explanation

Editing an indexing policy starts an index transformation that runs in the background and re-indexes existing items against the new policy. Queries continue to be served during the transformation, so no downtime or data copy is involved.

Question 25Design and develop database solutions

An application stores documents for many tenants, and queries almost always filter by both tenantId and userId. Which partition key design is best?

  1. /id only, because it has the highest cardinality
  2. Hierarchical on tenantId and userId Correct answer.
  3. /tenantId only, because tenants are the top-level boundary
  4. /userId only, because users are evenly distributed

Explanation

A hierarchical key on tenantId and userId keeps each tenant's data inside a bounded prefix, so the common query is scoped to a small set of logical partitions. The tenantId level also prevents one very large tenant from spreading across every partition, and userId adds granularity for large tenants.

Question 26Design and develop database solutions

What is the maximum number of levels that a hierarchical partition key can define on an Azure Cosmos DB for NoSQL container?

  1. Three levels Correct answer.
  2. Five levels
  3. Two levels
  4. Ten levels

Explanation

A hierarchical partition key supports up to three levels, for example /tenantId/userId/sessionId. Each unique combination of the values forms a logical partition that can be targeted directly by a query.

Question 27Design and develop database solutions

What is the minimum provisioned throughput, in RU/s, that can be set directly on an individual container in an Azure Cosmos DB for NoSQL account?

  1. 1,000 RU/s
  2. 250 RU/s
  3. 400 RU/s Correct answer.
  4. 100 RU/s

Explanation

Throughput provisioned directly on a container must be at least 400 RU/s. Smaller allocations are possible only when throughput is shared at the database level.

Question 28Design and develop database solutions

What is the maximum amount of data that a single logical partition can store in an Azure Cosmos DB for NoSQL container?

  1. 10 GB
  2. 20 GB Correct answer.
  3. 50 GB
  4. 2 GB

Explanation

A logical partition is capped at 20 GB of data and index storage. Once a logical partition reaches that limit, additional items with the same partition key value cannot be written.

Question 29Design and develop database solutions

Which consistency level does a new Azure Cosmos DB for NoSQL account use by default?

  1. Session Correct answer.
  2. Strong
  3. Bounded staleness
  4. Eventual

Explanation

New accounts are created with session consistency unless another level is selected. Session consistency guarantees read-your-own-writes within a client session while keeping latency low.

Question 30Design and develop database solutions

What is the maximum size of a single item in an Azure Cosmos DB for NoSQL container?

  1. 16 MB
  2. 4 MB
  3. 1 MB
  4. 2 MB Correct answer.

Explanation

An item, including its property names and values, cannot exceed 2 MB. Data that would exceed this limit must be split across multiple items.

Question 31Design and develop database solutions

By default, which path is excluded from indexing by the indexing policy of a new Azure Cosmos DB for NoSQL container?

  1. /id/?
  2. /_ts/?
  3. /_etag/? Correct answer.
  4. /*

Explanation

The default policy includes /* and excludes the ETag system property, because ETag values change on every write and are not useful to index. Other system properties such as _ts remain indexed through the wildcard path.

Question 32Design and develop database solutions

In the default change feed mode of Azure Cosmos DB for NoSQL, which operations appear in the change feed?

  1. Updates and deletes only
  2. Inserts, updates, and deletes
  3. Inserts only
  4. Inserts and updates only Correct answer.

Explanation

The default latest-version mode reports creates and updates, with each item appearing once at its most recent version. Delete operations are reported only in the all-versions-and-deletes mode.

Question 33Design and develop database solutions

What is the maximum size of a partition key value in Azure Cosmos DB for NoSQL?

  1. 4 KB
  2. 512 bytes
  3. 2 KB Correct answer.
  4. 1 KB

Explanation

A partition key value can be up to 2 KB in size. Keeping key values small reduces the storage overhead of the index that maps logical partitions.

Question 34Design and develop database solutions

A container is configured with autoscale throughput and a maximum of 10,000 RU/s. To what minimum throughput can the container scale down automatically?

  1. 400 RU/s
  2. 5,000 RU/s
  3. 100 RU/s
  4. 1,000 RU/s Correct answer.

Explanation

Autoscale scales between the configured maximum and one tenth of that maximum. For a 10,000 RU/s maximum, the floor is therefore 1,000 RU/s.

Question 35Design and develop database solutions

Which requirement must be met for a transactional batch in Azure Cosmos DB for NoSQL to succeed?

  1. All operations run in separate sessions.
  2. All operations use a different container.
  3. All operations use the same ETag value.
  4. All operations use the same logical partition key. Correct answer.

Explanation

A transactional batch is atomic only within one logical partition, so every operation must share the same partition key value. Operations across partitions must be sent as separate requests.

Question 36Design and develop database solutions

Which container does the change feed processor use to store checkpoint and coordination state?

  1. A dead-letter container
  2. A conflict container
  3. A leases container Correct answer.
  4. A backup container

Explanation

The change feed processor stores leases and continuation checkpoints in a dedicated leases container. Each instance acquires leases so that partitions are distributed across instances.

Question 37Design and develop database solutions

A client executes a stored procedure that creates or updates one item. What must the request include?

  1. The item's partition key value Correct answer.
  2. A continuation token
  3. The database's throughput value
  4. The container's ETag

Explanation

Stored procedures execute transactionally inside a single logical partition, so the request must be routed with the partition key value of the target partition. Without it, the call cannot be scoped to a partition.

Question 38Design and develop database solutions

Which workload does the Azure Synapse Link analytical store serve for an Azure Cosmos DB for NoSQL container?

  1. OLAP queries over near-real-time data Correct answer.
  2. Graph traversals across partitions
  3. OLTP queries with strong consistency
  4. Full-text search over JSON items

Explanation

The analytical store keeps a columnar copy of the data that analytical engines query without consuming transactional request units. It is intended for large aggregations and reporting over near-real-time data.

Question 39Design and develop database solutions

A parent item has an unbounded number of child items that are usually read on their own. Which modeling approach is recommended for Azure Cosmos DB for NoSQL?

  1. Duplicate the parent for each child
  2. Store children as separate items with the parent's key Correct answer.
  3. Store children in a container with a different key
  4. Embed all children in the parent item

Explanation

When the number of children is unbounded, embedding risks exceeding the 2 MB item limit. Storing children as separate items that share the parent's partition key keeps related data co-located for efficient reads.

Question 40Design and develop database solutions

A unique key policy defines /email on a container. Within which scope is the uniqueness of email values enforced?

  1. Each logical partition Correct answer.
  2. Each physical partition
  3. The entire database
  4. The entire container

Explanation

A unique key constraint is enforced inside a single logical partition. Two items in different logical partitions can therefore store the same email value.

Question 41Design and develop database solutions

A container uses consistent indexing, and a property used in a query filter is excluded from the indexing policy. What happens when the query runs?

  1. The query uses the index anyway
  2. The query runs as a scan with higher RU cost Correct answer.
  3. The query fails to compile
  4. The query returns partial results

Explanation

Filtering on an unindexed property is still possible, but the engine must scan items instead of seeking the index. The scan increases request unit consumption, which is why heavily queried properties should be indexed.

Question 42Design and develop database solutions

Which consistency level guarantees that reads never observe writes out of order, even though the data returned may be stale?

  1. Session
  2. Eventual
  3. Strong
  4. Consistent prefix Correct answer.

Explanation

Consistent prefix guarantees that updates are seen in the order in which they were written, without guaranteeing how recent the data is. Strong adds freshness, while eventual allows out-of-order reads.

Question 43Design and develop database solutions

Which change feed approach lets a client read changes without provisioning a leases container?

  1. The change feed processor
  2. The batch mode with stored procedures
  3. The push model with triggers
  4. The pull model with FeedIterator Correct answer.

Explanation

The pull model reads the change feed per physical partition with a FeedIterator and lets the client manage continuation tokens itself. Because no lease-based coordination is used, no leases container is required.

Question 44Design and develop database solutions

With last-writer-wins conflict resolution, which container setting determines which item wins?

  1. The conflict resolution procedure
  2. The conflict resolution path Correct answer.
  3. The default time to live value
  4. The container's indexing mode

Explanation

Last-writer-wins compares the numeric value found at the configured conflict resolution path, which is typically /_ts, and keeps the item with the higher value. No stored procedure is involved in this mode.

Question 45Design and develop database solutions

A query uses ARRAY_CONTAINS(c.tags, "blue"). Which index type must the tags path have for the query to be served efficiently?

  1. Composite
  2. Range Correct answer.
  3. Spatial
  4. Hash

Explanation

Array element membership checks are served by a range index on the array path, which the default /* range policy already provides. A hash index supports only equality on scalar values, and a composite index requires multiple ordered paths.

Question 46Design and develop database solutions

Two items in the same container have the same id value but different partition key values. What is the result of the second write?

  1. The second write fails with a conflict
  2. Both items are stored successfully Correct answer.
  3. The container rejects the partition key
  4. The second write overwrites the first item

Explanation

Within a container, an id must be unique only within its logical partition. Because the two items have different partition key values, they occupy different logical partitions and both writes succeed.

Question 47Design and develop database solutions

A query filters on c.type for equality and sorts by c.createdAt in descending order. Which composite index supports the query without a scan?

  1. [{"path":"/createdAt/?","order":"descending"}]
  2. [{"path":"/createdAt/?","order":"ascending"}]
  3. [{"path":"/type/?","order":"descending"},{"path":"/createdAt/?","order":"ascending"}]
  4. [{"path":"/type/?","order":"ascending"},{"path":"/createdAt/?","order":"descending"}] Correct answer.

Explanation

A composite index must list the equality-filtered property first and then the sort property in the direction used by ORDER BY. The descending order on /createdAt therefore matches the query, and any direction is acceptable for the leading equality property.

Question 48Design and develop database solutions

What delivery guarantee does the change feed processor provide when a lease is taken over by another instance after a failure?

  1. At-least-once Correct answer.
  2. Best-effort
  3. Exactly-once
  4. At-most-once

Explanation

The processor writes checkpoints after a batch is handled, so a batch interrupted before checkpointing is processed again by the new owner. Delegates should therefore be idempotent to tolerate duplicates.

Question 49Design and develop database solutions

An application submits a transactional batch that contains 150 operations. What is the result?

  1. The batch succeeds up to 100 operations
  2. The batch succeeds but is applied partially
  3. The batch is rejected Correct answer.
  4. The batch is split into two batches

Explanation

A transactional batch supports at most 100 operations and 2 MB of total payload. A batch exceeding those limits is rejected and must be divided by the application into smaller batches.

Question 50Design and develop database solutions

A pre-trigger is defined on an Azure Cosmos DB for NoSQL container. When does the trigger execute?

  1. Automatically on every create
  2. Automatically on every replace
  3. Whenever the container is reindexed
  4. Only when the request names it Correct answer.

Explanation

Triggers in the NoSQL API are not automatic; the client must name the trigger in the request options, for example through the pre-trigger include setting. This differs from triggers in relational databases.