View Full Microsoft DP-420 Exam Dumps and Practice Test Dumps.
Q1. You are designing an Azure Cosmos DB for NoSQL container for hotel reservations. Most operations retrieve reservations by hotel and reservation year. Individual hotels can generate extremely large amounts of historical data. Which partition-key approach should you consider?
- Use /reservationStatus only.
- Use one fixed partition-key value for all hotels.
- Use /guestName only.
- Use a hierarchical partition key such as /hotelId followed by /reservationYear.
Correct Answer: 4. Use a hierarchical partition key such as /hotelId followed by /reservationYear.
Explanation: A hierarchical partition key can align with hotel-based access while further distributing the data of high-volume hotels by year. This helps preserve efficient routing for requests that begin with hotel identity while reducing the risk that one hotel becomes excessively large or hot. Reservation status usually has low cardinality, while a constant key would prevent effective horizontal scaling. Guest name may have many values but does not match the primary access pattern. Good Cosmos DB partition design must consider data growth, logical-partition limits, query routing, and request-unit distribution together.
Q2. Your application needs to create an item only if another item with the same id and partition key does not already exist. Which SDK operation should you use?
- Upsert Item.
- Create Item.
- Patch Item.
- Replace Item.
Correct Answer: 2. Create Item.
Explanation: Create Item is appropriate when the application wants insertion semantics and must fail if the item identity already exists within the same logical partition. Upsert differs because it creates a new item when none exists but replaces the existing item when the same identity is found. Patch modifies selected fields of an existing document, while Replace rewrites an existing item. Choosing the correct SDK operation is important because it determines how duplicate identities are handled and whether an existing record can be overwritten unintentionally.
Q3. You need a query to determine whether a JSON document contains an array with exactly five elements. Which Cosmos DB SQL capability should you use?
- ARRAY_LENGTH
- IS_STRING
- DateTimeDiff
- VectorDistance
Correct Answer: 1. ARRAY_LENGTH
Explanation: ARRAY_LENGTH returns the number of elements in a JSON array and can be used in projections or predicates. For example, a query can filter documents where ARRAY_LENGTH(c.items) = 5. This is useful when application data is modeled using embedded arrays. IS_STRING checks a value’s type, DateTimeDiff calculates differences between dates, and VectorDistance performs vector similarity comparisons. Cosmos DB SQL includes many JSON-aware functions that let applications query nested structures directly instead of retrieving entire documents and processing them in application code.
Q4. You need multiple application instances to process the same Cosmos DB change feed workload without duplicating ownership of feed ranges. Which resource coordinates this processing?
- Analytical store.
- Integrated cache.
- Lease container.
- Unique key policy.
Correct Answer: 3. Lease container.
Explanation: The change feed processor uses a lease container to coordinate feed-range ownership, checkpoint progress, and load balancing among processor instances. Each processor instance acquires leases for portions of the feed so that the workload is distributed rather than unnecessarily duplicated. As processor instances scale in or out, leases can be rebalanced. Analytical store supports analytics, integrated cache reduces eligible read costs, and unique keys enforce document constraints. The lease container is therefore an important operational dependency when using the change feed processor framework.
Q5. You need to update a document’s inventory property by subtracting 1 without sending the entire document from the application. Which operation should you use?
- Replace the full document.
- Patch with an increment operation using a negative value.
- Delete and recreate the document.
- Execute a cross-partition query.
Correct Answer: 2. Patch with an increment operation using a negative value.
Explanation: Patch supports targeted modifications to document properties, including numeric increment operations. Supplying a negative increment value can decrease the inventory count without replacing the full item. This can reduce network payload and simplify application logic, especially for large documents where only one numeric field changes frequently. Replacing the entire document is valid but less targeted. Delete-and-create introduces unnecessary operations and can affect metadata or concurrency behavior. A cross-partition query retrieves data and does not provide the required efficient partial update.
Q6. You need an application to process every intermediate update to a document, not just the latest version, and also detect deletion events. Which change feed mode should you select?
- Latest version mode.
- Integrated cache mode.
- Pull mode without version history.
- All versions and deletes mode.
Correct Answer: 4. All versions and deletes mode.
Explanation: All versions and deletes mode is intended for workloads that need richer history than the default latest-version change feed. It can expose intermediate item versions and deletion information within the supported retention model, making it appropriate for auditing, synchronization, and certain event-history scenarios. Latest version mode focuses on the newest state of changed documents and may not surface every intermediate update. Integrated cache is unrelated, while pull mode describes how a consumer accesses the feed rather than whether complete version history is available.
Q7. Your application performs many reads of documents that are identified by id and partition key. Which factor usually makes these reads particularly efficient?
- They can use point-read operations.
- They always use a full-text index.
- They require analytical store.
- They automatically use a stored procedure.
Correct Answer: 1. They can use point-read operations.
Explanation: When an application’s data model makes both the item ID and partition-key value available, the SDK can issue point reads. Point reads avoid SQL query processing and are typically among the lowest-cost, lowest-latency Cosmos DB read operations. Full-text indexes are for text search, analytical store is for analytics, and stored procedures are not required for direct item retrieval. Designing APIs and references so the partition key is available alongside the item ID can significantly improve efficiency for frequently accessed records.
Q8. Your Cosmos DB account contains a container with a large rawMessage property that is never filtered, sorted, or searched. The workload is write-heavy. What should you consider?
- Add several composite indexes to rawMessage.
- Make rawMessage the partition key.
- Exclude the rawMessage path from indexing.
- Enable Strong consistency.
Correct Answer: 3. Exclude the rawMessage path from indexing.
Explanation: Excluding unused paths from indexing can reduce the index-maintenance overhead associated with writes. Large high-cardinality properties such as raw messages, diagnostic payloads, or embedded audit details can increase write cost if indexed despite never participating in queries. Composite indexes would increase indexing work rather than reduce it. Changing the partition key is a separate modeling decision, and Strong consistency affects read guarantees. Indexing should reflect actual query patterns so the application receives needed read performance without paying unnecessary write and storage costs.
Q9. Your globally distributed application must accept writes close to users in North America, Europe, and Asia. Which Cosmos DB capability should you enable?
- Integrated cache.
- Periodic backup.
- One read region only.
- Multi-region writes.
Correct Answer: 4. Multi-region writes.
Explanation: Multi-region writes allow more than one Azure region to accept write operations, enabling geographically distributed applications to write closer to their users and continue writing if one region becomes unavailable. This architecture can reduce write latency and improve availability but introduces the possibility of concurrent write conflicts. The design must therefore include an appropriate conflict-resolution strategy. Integrated cache improves eligible reads, while backup and single-region configurations do not provide distributed write capabilities.
Q10. You need to calculate the number of hours between two timestamp properties inside a Cosmos DB SQL query. Which function is appropriate?
- DateTimeDiff
- ARRAY_CONTAINS
- IS_OBJECT
- VectorDistance
Correct Answer: 1. DateTimeDiff
Explanation: DateTimeDiff can calculate the difference between compatible date-time values using a specified unit such as seconds, minutes, hours, or days. This is useful when duration logic belongs naturally in the query, such as filtering records that remained open for more than a certain number of hours. ARRAY_CONTAINS works with arrays, IS_OBJECT checks JSON types, and VectorDistance supports vector similarity. Query-side date calculations can simplify applications, but their RU cost should still be measured for large workloads.
Q11. A container’s indexing policy is changed substantially in production. What should you monitor while Cosmos DB applies the new policy?
- Only the account’s region count.
- Index transformation progress and workload performance.
- Only the TTL value.
- The number of session tokens.
Correct Answer: 2. Index transformation progress and workload performance.
Explanation: Significant indexing changes can trigger an index transformation so existing data becomes compatible with the new indexing configuration. During this period, teams should monitor transformation progress as well as request-unit consumption, query behavior, and write performance. Indexes that improve reads may add write overhead, so both sides of the workload should be validated. Region count, TTL, and session-token details do not describe index transformation health. Index-policy changes should be treated as controlled production configuration changes and tested before wide deployment.
Q12. You need to store embedding vectors and perform similarity searches directly inside Cosmos DB. What is required?
- A full-text policy only.
- TTL.
- A vector embedding policy and suitable vector index.
- A unique key on the embedding array.
Correct Answer: 3. A vector embedding policy and suitable vector index.
Explanation: Cosmos DB vector search requires configuration describing the embedding path and its characteristics, such as dimensions, type, and distance function. A suitable vector index then accelerates similarity searches. This enables scenarios such as semantic search, recommendations, and retrieval-augmented generation without moving the vectors to a separate database. Full-text policies address text search, TTL controls retention, and unique keys enforce constraints. The embedding model used by the application must produce vectors that match the configured vector dimensions and distance semantics.
Q13. You need to create a search experience that combines semantic similarity with exact keyword relevance. Which design should you use?
- Hybrid search using vector and full-text capabilities.
- TTL plus a unique key.
- Integrated cache only.
- Change feed leases.
Correct Answer: 1. Hybrid search using vector and full-text capabilities.
Explanation: Hybrid search combines vector similarity with lexical or full-text relevance so applications can benefit from both semantic meaning and exact textual matches. This can improve retrieval quality for product discovery, knowledge bases, and RAG applications. Vector search is useful when concepts are similar even if wording differs, while full-text search captures keyword and language-oriented relevance. TTL, unique keys, cache, and leases solve unrelated lifecycle, integrity, performance, and change-processing concerns.
Q14. You need Cosmos DB changes to automatically invoke lightweight serverless business logic. Which Azure integration is most appropriate?
- Azure Bastion.
- Azure Monitor Workbook.
- Azure DNS.
- Azure Functions with a Cosmos DB trigger.
Correct Answer: 4. Azure Functions with a Cosmos DB trigger.
Explanation: The Azure Functions Cosmos DB trigger uses the change feed to invoke function code when new or updated items are available. It is suitable for serverless event-driven workflows such as notifications, integrations, aggregation, and denormalized projections. Bastion provides secure VM access, Monitor Workbooks provide observability, and DNS handles name resolution. Trigger-based code should be idempotent because retries may occur, and processor lag should be monitored when downstream freshness is important.
Q15. A Spark workload needs direct read and write access to the Cosmos DB transactional store. Which integration should you use?
- Analytical store only.
- Azure Cosmos DB Spark connector.
- Azure Monitor.
- Periodic backup.
Correct Answer: 2. Azure Cosmos DB Spark connector.
Explanation: The Cosmos DB Spark connector allows distributed Spark jobs to interact directly with the transactional store for supported reads and writes. It is appropriate for transformations, migrations, or enrichment pipelines where Spark processing must persist results back into Cosmos DB. Analytical store is better suited for analytics that should be isolated from transactional RU usage. Azure Monitor provides observability, and backup provides recovery. Spark jobs should be tuned carefully because direct transactional-store access consumes request units and can affect application workloads.
Q16. Your reporting workload performs very large analytical scans over operational Cosmos DB data. You want to minimize impact on transactional RU consumption. What should you use?
- Strong consistency.
- Transactional Batch.
- Analytical store.
- Integrated cache only.
Correct Answer: 3. Analytical store.
Explanation: Analytical store provides a column-oriented representation of Cosmos DB data intended for large-scale analytics. It allows analytical tools to scan data without placing the same pressure on the transactional request-unit workload. This is useful for reporting, Spark analysis, and other read-intensive scenarios. Integrated cache helps repeated operational reads but is not a replacement for a dedicated analytical representation. Strong consistency and Transactional Batch address different correctness and transaction requirements.
Q17. You need to know whether a change feed processor is getting behind the incoming write rate. Which feature should you use?
- TTL.
- Integrated cache.
- Unique key metrics.
- Change feed estimator.
Correct Answer: 4. Change feed estimator.
Explanation: The change feed estimator reports an estimate of pending work for a change feed processor. A growing backlog indicates that changes are arriving faster than the processors are handling them. This can guide scale-out decisions or reveal that more Cosmos DB throughput is needed for downstream processing. TTL, cache, and unique keys do not provide processor-lag visibility. Monitoring change feed lag is especially important when projections or downstream integrations need to stay close to real time.
Q18. You need to recover a Cosmos DB container to the state it had immediately before a faulty deployment. The account already uses continuous backup. What should you identify?
- The current continuation token.
- A valid point-in-time restore timestamp before the deployment.
- The latest session token.
- The integrated-cache age.
Correct Answer: 2. A valid point-in-time restore timestamp before the deployment.
Explanation: Continuous backup supports point-in-time restore within its retention window. To recover from a bad deployment, administrators should determine when the damaging changes began and choose a restore point just before that time. The resource scope and restored data should then be validated before applications resume using it. Continuation tokens, session tokens, and cache settings do not describe recovery state. Restore procedures should be tested ahead of incidents so operators can quickly identify timestamps and affected resources.
Q19. You need an automated warning when one partition repeatedly approaches its available RU capacity. What should you configure?
- Azure Monitor alerts based on partition-level throughput metrics.
- A SQL UDF.
- TTL.
- A unique key policy.
Correct Answer: 1. Azure Monitor alerts based on partition-level throughput metrics.
Explanation: Partition-level throughput metrics can reveal hot partitions that account-level averages may hide. Azure Monitor can evaluate these metrics and trigger alerts when a partition remains near capacity for a defined period. This allows operations teams to investigate partition-key skew, high-volume tenants, or sudden traffic changes before sustained throttling impacts users. UDFs, TTL, and unique keys solve different query, retention, and integrity needs. Effective Cosmos DB monitoring should include both aggregate and partition-level indicators.
Q20. You need detailed Cosmos DB resource logs to be searchable alongside application telemetry using Kusto Query Language. What should you configure?
- Integrated cache.
- TTL.
- Azure Monitor diagnostic settings that send logs to a Log Analytics workspace.
- A composite index.
Correct Answer: 3. Azure Monitor diagnostic settings that send logs to a Log Analytics workspace.
Explanation: Diagnostic settings can route Cosmos DB resource logs into a Log Analytics workspace, where Kusto Query Language can be used for troubleshooting, auditing, security investigations, and correlation with application telemetry. This centralized approach is much more effective than reviewing isolated signals from individual systems. Integrated cache optimizes reads, TTL controls expiration, and composite indexes optimize queries. Production systems should retain logs according to operational and compliance requirements and include useful correlation information in application telemetry.