Microsoft DP-420 Practice Test Questions and Exam Dumps Part20 Q381-400

 

View Full Microsoft DP-420 Exam Dumps and Practice Test Dumps.


Q1. You are designing an Azure Cosmos DB for NoSQL container for a logistics application. Most requests retrieve shipments by warehouseId, but warehouse traffic varies greatly. Which design consideration is most important when selecting the partition key?

  1. Ensure every warehouse stores exactly the same number of documents.
  2. Evaluate both data distribution and request-unit distribution across warehouse values.
  3. Use the lowest-cardinality property available.
  4. Use a property that is never included in queries.

Correct Answer: 2. Evaluate both data distribution and request-unit distribution across warehouse values.

Explanation: A good Cosmos DB partition key must distribute not only stored data but also request-unit consumption. A warehouse might hold a reasonable share of the data yet receive a disproportionate amount of traffic, creating a hot partition. Therefore, partition-key evaluation should include expected storage growth, read and write patterns, transaction boundaries, and throughput distribution. Low-cardinality keys often create concentration problems, while properties never used in routing may force cross-partition queries. Production monitoring should confirm that the original assumptions about both data and request distribution remain valid as the workload grows.

Q2. A web API creates an Azure Cosmos DB client object every time a request arrives. The application experiences connection overhead and reduced throughput. What should you change?

  1. Create a separate client for every container.
  2. Recreate the client after every write only.
  3. Use a stored procedure instead of the SDK.
  4. Reuse a long-lived singleton Cosmos DB client.

Correct Answer: 4. Reuse a long-lived singleton Cosmos DB client.

Explanation: Cosmos DB SDK clients are designed to be long-lived and reused. A singleton client can reuse connections, routing information, caches, and other internal resources, reducing connection overhead and improving throughput. Repeatedly creating and disposing clients can lead to inefficient connection handling, socket exhaustion, and increased latency. A separate client per container is generally unnecessary because one client can work with multiple databases and containers in the same account. Stored procedures serve transactional server-side logic and do not replace proper client lifecycle management in the application.

Q3. You need to measure how expensive a single item write is in request units during performance testing. Where should you obtain the value?

  1. From the operation response’s request-charge information.
  2. From the item’s TTL property.
  3. From the account’s region count.
  4. From the partition-key name.

Correct Answer: 1. From the operation response’s request-charge information.

Explanation: Cosmos DB SDK operation responses expose the request charge consumed by the operation. Capturing this value is one of the most direct ways to compare the cost of creates, replaces, patches, reads, and queries. Request-unit measurements should be collected using representative item sizes and production-like indexing policies because those factors can affect cost. TTL, region count, and the partition-key name do not report the RU consumption of an individual request. Measuring real operation charges is especially useful when sizing throughput or comparing alternative implementation strategies.

Q4. You need a SQL query to return only documents where the rating property is a string rather than a number. Which function should you use?

  1. ARRAY_CONTAINS
  2. DateTimeDiff
  3. IS_STRING
  4. VectorDistance

Correct Answer: 3. IS_STRING

Explanation: Cosmos DB for NoSQL SQL provides type-checking functions that help query flexible JSON schemas. IS_STRING tests whether a property contains a string value, which is useful when the same property may contain different data types in different documents. ARRAY_CONTAINS checks arrays, DateTimeDiff performs date calculations, and VectorDistance compares embeddings. Type-checking functions are particularly useful during schema evolution or when legacy data contains inconsistent representations. They allow the query to safely isolate documents with the expected type before applying additional logic.

Q5. You are building an API that should create a new record when it does not exist but overwrite the existing record when the same identity already exists. Which operation should you use?

  1. Upsert Item.
  2. Read Item.
  3. Delete Item.
  4. Query Items.

Correct Answer: 1. Upsert Item.

Explanation: Upsert combines create and replace semantics. If no item exists with the specified id and partition-key value, Cosmos DB creates it. If the item already exists, the existing document is replaced. This simplifies application code when separate insert and replacement paths are unnecessary. Create Item is preferable when duplicates must cause a failure rather than an overwrite. Read and Query operations do not mutate data, while Delete removes an item. Applications using Upsert should still consider optimistic concurrency when multiple clients can modify the same record simultaneously.

Q6. A high-volume ingestion application must retry transient Cosmos DB failures safely. Which implementation principle is most appropriate?

  1. Retry every failure immediately without delay.
  2. Disable SDK retry handling.
  3. Convert all operations into cross-partition queries.
  4. Use SDK retry guidance and respect retry-after information for transient errors.

Correct Answer: 4. Use SDK retry guidance and respect retry-after information for transient errors.

Explanation: Transient cloud failures and throttling should be handled with controlled retry behavior rather than immediate unlimited retries. Cosmos DB SDKs include retry handling for appropriate conditions, and HTTP 429 responses include retry guidance that should be respected. Aggressive retries can increase load and make throttling worse. Disabling all retries reduces resilience, while converting operations into cross-partition queries would typically increase RU cost. Reliable applications distinguish between transient and permanent failures and use bounded retries, diagnostics, and server-provided timing information to recover without creating additional pressure.

Q7. You need to query an item’s nested measurements array and return each measurement as a separate result row. Which SQL construct should you use?

  1. GROUP BY
  2. JOIN over the nested array.
  3. TTL.
  4. VectorDistance

Correct Answer: 2. JOIN over the nested array.

Explanation: Cosmos DB SQL supports JOIN semantics for iterating through arrays inside a single JSON item. A JOIN can flatten the elements of measurements so each element appears independently in the query results or can be filtered by its own properties. This is different from relational joins between arbitrary containers. GROUP BY aggregates values, TTL controls item expiration, and VectorDistance performs similarity comparisons between vectors. JOIN is particularly useful when documents embed arrays but the application needs to analyze individual members of those arrays.

Q8. You need several creates and deletes to execute atomically, but the items use different partition-key values. What is the main limitation?

  1. Cosmos DB does not allow deletes inside transactions.
  2. Atomic operations require Strong consistency.
  3. Cosmos DB transactional scope does not span different logical partitions.
  4. Transactional Batch works only with analytical store.

Correct Answer: 3. Cosmos DB transactional scope does not span different logical partitions.

Explanation: Cosmos DB transactional operations such as Transactional Batch and stored procedures are scoped to a single logical partition. If the items have different partition-key values, they cannot participate in one atomic Cosmos DB transaction. This is why transaction requirements must be considered during partition-key design. Deletes are allowed in transactional operations when other conditions are met, and Strong consistency is not a requirement for Transactional Batch. Analytical store is unrelated to transactional writes. Cross-partition workflows often require application-level orchestration or eventual consistency patterns.

Q9. Your organization requires a globally distributed application to continue accepting writes even if one write region becomes unavailable. Which feature should you enable?

  1. Integrated cache.
  2. Continuous backup.
  3. A full-text index.
  4. Multi-region writes.

Correct Answer: 4. Multi-region writes.

Explanation: Multi-region writes allow more than one configured Azure region to accept write operations. This improves write availability and can reduce latency for geographically distributed users. If one region becomes unavailable, another writable region can continue processing changes. The architecture should also include a conflict-resolution strategy because concurrent updates to the same item can occur across regions. Integrated cache, backup, and full-text indexing solve different performance, recovery, and search requirements. Global write topology should be selected based on availability, latency, data-residency, and cost objectives.

Q10. You need to route read requests from an application instance to a nearby Cosmos DB region whenever possible. Which SDK configuration should you use?

  1. Preferred regions.
  2. TTL.
  3. Unique keys.
  4. A lease container.

Correct Answer: 1. Preferred regions.

Explanation: Preferred-region configuration lets the Cosmos DB SDK prioritize specific account regions for request routing. An application can list regions in an order that reflects network proximity or operational preferences. If the first region is unavailable, the SDK can use another healthy region from the configured topology. TTL manages expiration, unique keys enforce integrity, and lease containers coordinate change feed processing. Preferred regions should be aligned with application deployment locations and tested together with failover settings so the intended resilience and latency characteristics are achieved.

Q11. You need the complete history of updates and deletions from a container for compliance auditing. Which change feed mode is appropriate?

  1. Latest version mode.
  2. All versions and deletes mode.
  3. Integrated cache mode.
  4. Analytical store mode.

Correct Answer: 2. All versions and deletes mode.

Explanation: All versions and deletes mode is intended for scenarios where intermediate updates and deletion events must be available, such as audit or synchronization workloads. It provides richer history than latest-version mode, which focuses on the latest state of created and updated items and does not normally provide deletion events. This mode depends on continuous backup and its retention window. Integrated cache and analytical store are unrelated to change feed history. Applications requiring a complete change trail should also monitor processing lag so required versions are consumed while still retained.

Q12. You need to maintain a reporting summary from transaction changes without recalculating the full historical dataset. Which pattern should you implement?

  1. Re-run a full cross-partition aggregation after every change.
  2. Store the summary only in cache.
  3. Use change feed processing to persist incremental aggregates.
  4. Disable indexing.

Correct Answer: 3. Use change feed processing to persist incremental aggregates.

Explanation: Change feed processing can maintain persistent aggregates by reacting incrementally to source changes. A processor can update a daily, monthly, or customer-level summary document whenever a transaction changes, avoiding repeated scans of the entire transaction history. This improves efficiency and supports read-optimized reporting models. The processor should be idempotent and tolerate retries. Cache is not durable summary storage, while disabling indexing does not maintain aggregates. Persisted aggregation is a common NoSQL denormalization pattern because it trades some write complexity for much faster analytical reads.

Q13. You need to move Cosmos DB changes into a high-throughput streaming platform so many downstream consumer groups can process them independently. Which Azure service should you use?

  1. Azure DNS.
  2. Azure Bastion.
  3. Azure Policy.
  4. Azure Event Hubs.

Correct Answer: 4. Azure Event Hubs.

Explanation: Azure Event Hubs is built for high-throughput event ingestion and supports multiple independent consumer groups. A change feed consumer or Azure Function can publish Cosmos DB changes into Event Hubs, making them available to many downstream applications, analytics processors, or integration services. Azure DNS provides name resolution, Bastion provides secure virtual-machine access, and Azure Policy governs resource compliance. Event Hubs is a natural choice when operational database changes need to become part of a broader event-driven architecture with multiple independent consumers.

Q14. A data engineering team needs distributed Spark transformations and must write the processed documents back to Cosmos DB. Which integration is appropriate?

  1. Azure Cosmos DB Spark connector.
  2. Integrated cache.
  3. Periodic backup.
  4. A stored procedure only.

Correct Answer: 1. Azure Cosmos DB Spark connector.

Explanation: The Cosmos DB Spark connector allows Spark workloads to interact directly with the transactional store for supported reads and writes. It is useful for distributed enrichment, transformation, migration, and data-processing workflows. Integrated cache is designed for eligible application reads, while periodic backup supports recovery. Stored procedures are scoped to one logical partition and are not a general distributed-processing replacement. Spark-based writes consume transactional request units, so workloads should be tuned carefully to avoid saturating production throughput or creating hot partitions.

Q15. You need Cosmos DB data to be available in Microsoft Fabric for analytics without building a custom replication pipeline. Which feature should you evaluate?

  1. TTL.
  2. Cosmos DB Mirroring for Microsoft Fabric.
  3. Transactional Batch.
  4. A continuation token.

Correct Answer: 2. Cosmos DB Mirroring for Microsoft Fabric.

Explanation: Cosmos DB Mirroring for Microsoft Fabric provides a managed path for replicating operational Cosmos DB data into Fabric analytical scenarios with less custom ETL engineering. It can simplify reporting and analytics architectures where Cosmos DB serves as the operational data store. Transactional Batch is for atomic same-partition writes, TTL controls retention, and continuation tokens support query paging. Mirroring should be compared with Spark-based options depending on whether the requirement is managed analytical replication or direct distributed transformation and writeback.

Q16. You need analytical tools to scan very large Cosmos DB datasets without placing equivalent RU pressure on the transactional store. Which capability should you enable?

  1. Manual failover.
  2. Strong consistency.
  3. Analytical store.
  4. Integrated cache only.

Correct Answer: 3. Analytical store.

Explanation: Analytical store provides a column-oriented representation of Cosmos DB data optimized for analytical workloads. It helps separate large scans, reporting, and Spark analysis from the request-unit consumption of the transactional store. This improves workload isolation so analytical processing is less likely to interfere with latency-sensitive application traffic. Integrated cache is helpful for repeated operational reads but is not a substitute for analytical store. Failover and consistency address resilience and read semantics rather than analytical workload separation.

Q17. You need Cosmos DB documents containing sensitive fields to be encrypted on the client before they reach the database service. Which capability should you consider?

  1. Always Encrypted.
  2. Composite indexing.
  3. TTL.
  4. Change feed estimator.

Correct Answer: 1. Always Encrypted.

Explanation: Always Encrypted provides client-side encryption for selected Cosmos DB properties so plaintext values are protected before they are transmitted to the database service. This is useful for particularly sensitive information where field-level protection is required in addition to normal encryption at rest. Encryption keys and metadata must be managed carefully, and some query behaviors may be constrained depending on the encryption configuration. Composite indexes, TTL, and change feed estimation do not provide client-side field encryption. Security architecture should also include appropriate identity, role assignments, and network controls.

Q18. You need application traffic to Cosmos DB to remain inside approved private Azure networking. What should you configure?

  1. A continuation token.
  2. A private endpoint through Azure Private Link.
  3. A SQL UDF.
  4. TTL.

Correct Answer: 2. A private endpoint through Azure Private Link.

Explanation: A private endpoint gives a Cosmos DB account a private IP address within a virtual network through Azure Private Link. Applications can then access the account over private Azure networking rather than relying on the public endpoint. Public network access can be restricted according to the organization’s security policy. Correct DNS configuration is essential so the Cosmos DB hostname resolves to the private endpoint. Continuation tokens, UDFs, and TTL solve query and lifecycle concerns rather than network isolation.

Q19. A production account begins returning frequent HTTP 429 responses. Which metric should you inspect to determine whether the workload is approaching available throughput?

  1. Normalized RU Consumption.
  2. Backup interval.
  3. Number of Azure regions only.
  4. Number of stored procedures.

Correct Answer: 1. Normalized RU Consumption.

Explanation: Normalized RU Consumption shows how much of the available throughput is being used relative to the account or partition capacity. Persistently high values can indicate that the workload is approaching its RU limit and may experience throttling. It is also important to inspect partition-level metrics because a hot partition can cause 429 responses even when aggregate utilization appears moderate. Backup interval, region count, and stored-procedure count do not measure throughput saturation. Monitoring should correlate normalized RU usage with status codes, latency, and partition distribution.

Q20. You need an automatic operational notification when server-side latency exceeds a threshold for a sustained period. What should you configure?

  1. A composite index.
  2. TTL.
  3. A unique key policy.
  4. An Azure Monitor alert rule and action group.

Correct Answer: 4. An Azure Monitor alert rule and action group.

Explanation: Azure Monitor alert rules can evaluate Cosmos DB metrics such as server-side latency over a defined time interval and trigger an action group when conditions remain above an acceptable threshold. Action groups can send notifications or invoke automated workflows. This supports proactive operational response before sustained latency becomes a serious user-facing problem. Composite indexes may affect query performance but do not provide notifications. TTL and unique key policies serve lifecycle and integrity needs. Alerts should be based on thresholds that reflect realistic service objectives and normal workload behavior.