Limited-Time Offer: Enjoy 50% Savings! Coupon code: 50OFF Use it at checkout
Skip to content

Free Microsoft Building AI Applications with Azure Cosmos DB DP-420 Exam Questions

Last updated: · 10 practice questions with answers and explanations

Page: 1 / 14 Total 204 questions

Want more questions? Get Premium Access.

Question 1

New Single answer

Topic: Design and develop database solutions

Skill tested: Selects a partition key that distributes high-throughput writes while supporting tenant-scoped access.

A telemetry service stores events for thousands of customer devices in Azure Cosmos DB for NoSQL. Queries usually retrieve one device's events over a time range, and each device can generate bursts exceeding the throughput available to a single logical partition. The current container is partitioned by customerId, so several large customers are approaching the per-partition storage and throughput limits. The application must retain customer-scoped query support, but a hot device must not force unrelated devices to share its write bottleneck. Which partition-key design is the best fit?

Correct Answer: C. Use deviceId as the partition key and include customerId as a regular indexed property.
Explanation:

Partitioning by deviceId distributes a large customer's devices across logical partitions and prevents a single customer partition from becoming the shared write bottleneck. Customer-scoped queries can still filter on customerId, though they may fan out across partitions; the scenario prioritizes distributing device-level bursts. Raising throughput does not remove logical-partition limits, and timestamp partitioning can create poor query locality and hot values depending on timestamp granularity. A constant key places all data in one logical partition.

Question 2

New Multiple answers

Topic: Design and develop database solutions

Skill tested: Chooses point reads over SQL queries when both the item ID and partition key are known.

A reservation API stores each reservation with a unique id and a tenantId partition key. After receiving a request, the service already has both values and must retrieve exactly one reservation with minimum latency and request-unit cost. The API currently constructs a SQL query with filters on id and tenantId. The team must preserve the existing container layout and does not need to retrieve related reservations. Which two changes should the team make? Select TWO.

Correct Answer: D. Use ReadMany with the known id and tenantId pair to retrieve the single item.; E. Call the SDK item-read operation with the reservation id and its tenantId partition-key value.
Explanation:

A point read needs the item id and full partition-key value, and it directly addresses one item without query execution overhead. ReadMany is also appropriate when the caller supplies known id/partition-key pairs; it can batch known-item retrieval and supports this single-pair case. Adding ORDER BY does not turn SQL into a point read. Omitting the partition key does not meet the point-read addressing requirement, while an id-only query still incurs query processing and can fan out.

Question 3

New Single answer

Topic: Design and develop database solutions

Skill tested: Implements continuation-token paging that remains reliable across stateless service requests.

A reporting endpoint returns pages of documents from a Cosmos DB container. The service is stateless: any application instance may handle the next HTTP request, and clients can pause between pages. The result set can be large, so the endpoint must avoid loading all results into memory. The team needs a paging approach that resumes query execution without relying on an offset, and it must tolerate a page containing fewer items than the requested page size. What should the endpoint use?

Correct Answer: B. Use a continuation token returned by the SDK and pass it back with the same query on the next request.
Explanation:

A continuation token is an opaque resume marker returned by query execution and can be carried across stateless requests; the SDK can continue the same query from that token. Page boundaries are determined by execution and resource limits, so a response may contain fewer items than the requested maximum. OFFSET-style paging repeatedly skips results and is inefficient for large offsets. Keeping an iterator in process memory or buffering the complete result set conflicts with statelessness and scalability.

Question 4

New Single answer

Topic: Design and develop database solutions

Skill tested: Uses transactional batch operations within one logical partition for atomic item changes.

An order-processing service stores an order header and its line items in a container partitioned by orderId. A status transition must update the header and create an audit item as one atomic operation. Both items use the same orderId partition-key value, and the service should avoid a separate stored procedure. Which implementation meets the atomicity requirement?

Correct Answer: C. Submit both operations in a transactional batch scoped to the orderId partition key.
Explanation:

Cosmos DB transactional batches provide ACID transactional behavior for supported operations within a single logical partition. Because both items share the orderId partition key, the header update and audit-item creation can be submitted together under that scope. Independent concurrent writes can partially succeed and therefore do not provide atomicity. A batch cannot span different partition-key values, and a query statement is not a multi-item transactional update/insert mechanism.

Question 5

New Multiple answers

Topic: Secure, optimize, and deploy database solutions

Skill tested: Configures least-privilege data-plane access with Microsoft Entra ID and scoped Cosmos DB roles.

A deployment team must let a background worker read and write items in one specific container while preventing it from accessing other containers. The worker runs on an Azure compute resource that supports a managed identity. The organization prohibits storing account keys in application settings and wants permissions managed through Azure role assignments. Which TWO steps satisfy these requirements? Select TWO.

Correct Answer: A. Enable the resource's managed identity and configure the worker's Cosmos DB SDK client to authenticate with Microsoft Entra ID.; C. Assign the worker the Cosmos DB Built-in Data Contributor role scoped to the required container.
Explanation:

The managed identity lets the application obtain Microsoft Entra credentials without embedding account keys. The Cosmos DB Built-in Data Contributor data-plane role grants item read/write capabilities, and scoping its assignment to the target container limits access as required. Subscription Owner is excessively broad and is not the least-privilege data-plane assignment sought here. Key Vault storage still uses an account key, contrary to policy. Data Reader is read-only and account-wide in the proposed assignment.

Question 6

New Multiple answers

Topic: Secure, optimize, and deploy database solutions

Skill tested: Applies private connectivity and network restrictions without exposing the Cosmos DB account publicly.

A financial application's Cosmos DB account must be reachable only from its application virtual network and an on-premises network connected through VPN. Public internet clients must not reach the account, and administrators do not want to manage changing client public IP addresses. The application uses the account's normal service endpoint and the organization can update its DNS configuration. Which TWO network changes should be made? Select TWO.

Correct Answer: C. Disable public network access after validating private endpoint connectivity.; D. Create a private endpoint for the Cosmos DB account in the application virtual network.
Explanation:

A private endpoint provides private IP connectivity to the account from the virtual network; VPN-connected on-premises clients can reach that network path when routing and DNS are configured appropriately. Disabling public network access prevents access through the public endpoint once private connectivity is validated. Account keys are authentication credentials, not network isolation. IP allow lists are fragile for changing client addresses and do not meet the private-only requirement. Leaving public access broadly enabled also violates the stated boundary.

Question 7

New Single answer

Topic: Secure, optimize, and deploy database solutions

Skill tested: Uses query metrics to identify cross-partition work and reduce unnecessary RU consumption.

A product catalog query filters on categoryId, orders by updatedAt, and returns a small page of results. Its request charge is unexpectedly high. Diagnostics show that the query is issued without a partition-key filter, and the container has no composite index for the filter-and-sort combination. The application frequently requests a specific category, and its response needs only five projected fields. What is the best first optimization?

Correct Answer: C. Add the known partition-key value to the query and project only the five required fields; then assess index metrics for the filter and sort.
Explanation:

Supplying the partition-key value can route the query to the relevant logical partition instead of querying across partitions. Projecting only needed properties reduces response payload and processing, and index metrics can guide whether an indexing-policy change - such as a suitable composite index for the filter/order pattern - is warranted. More throughput does not make an inefficient query consume fewer RUs. Disabling indexing can make this query more expensive or unsupported by efficient index access, and categoryId is not the item id for a point read.

Question 8

New Single answer

Topic: Implement AI and analytics capabilities in database solutions

Skill tested: Selects a vector index strategy consistent with embedding dimensions and similarity-search requirements.

A support platform stores text embeddings in a Cosmos DB for NoSQL container and performs approximate nearest-neighbor search over a large corpus. The model emits vectors with a fixed, known dimension, and the application accepts approximate results in exchange for lower search cost and latency. The team is configuring the container's vector embedding policy and vector index. Which approach best matches these requirements?

Correct Answer: D. Define the vector path, set its embedding dimensions and distance function, and configure a DiskANN vector index for approximate search.
Explanation:

A vector embedding policy declares the vector property path, dimensions, and similarity distance function, while a vector index supports vector-search operations. DiskANN is an approximate nearest-neighbor index option suited to large-scale search where approximation is acceptable. A range index does not provide vector nearest-neighbor semantics; full-text indexing is for tokenized text, not numeric embeddings. Lexicographic sorting over components is not a valid substitute for similarity search.

Question 9

New Multiple answers

Topic: Implement AI and analytics capabilities in database solutions

Skill tested: Combines full-text relevance and vector similarity in a hybrid Cosmos DB search query.

A knowledge assistant must retrieve support documents that are both semantically similar to a user's question and textually relevant to exact product terminology. The corpus contains a text field indexed for full-text search and a separately configured vector field. Product names and error codes are important, but users also phrase questions differently from the source material. The application should combine lexical and semantic signals rather than choose one retrieval method. Which TWO elements should the query design include? Select TWO.

Correct Answer: A. Apply a full-text search predicate to the indexed text field using the user's query terms.; B. Run vector similarity search against the configured embedding field using the query embedding.
Explanation:

Hybrid retrieval uses full-text search to capture exact lexical matches such as product names and error codes, while vector similarity finds semantically related content despite wording differences. Combining both signals supports the stated relevance goal, subject to the application's chosen ranking or score-combination strategy. Prefix filtering and document-id sorting provide neither full-text relevance nor semantic similarity. Embeddings are not partition keys, and disabling the vector index does not turn lexical results into vector-ranked results.

Question 10

New Single answer

Topic: Implement AI and analytics capabilities in database solutions

Skill tested: Chooses an appropriate vector index for exact search on a small, constrained vector collection.

A team is prototyping semantic retrieval over a small, tightly bounded set of product descriptions. The dataset size is known to remain within the supported limits for the Cosmos DB vector index configuration, and the team values exact nearest-neighbor results over approximate search. The container has an embedding field with a defined vector embedding policy. Which index type should the team choose for this requirement?

Correct Answer: C. Flat vector index, configured for the embedding field.
Explanation:

The Flat vector index performs exhaustive vector comparison and is appropriate when the vector collection is small enough for its supported limits and exact nearest-neighbor results are desired. DiskANN is designed for approximate nearest-neighbor search and is attractive at larger scale, but exactness is the key constraint here. Full-text indexes operate on text content, while spatial indexes support spatial data types rather than embedding vectors.