Microsoft DP-420 Practice Test Questions and Exam Dumps Part7 Q121-140

 

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


Q1. You are designing an Azure Cosmos DB container for a multi-tenant application. Most queries retrieve data for one tenant, but individual tenants may eventually store more than 20 GB. Which partitioning approach should you consider?

  1. Use a single fixed partition key value for all tenants.
  2. Use a hierarchical partition key beginning with /tenantId and followed by a higher-cardinality property.
  3. Use /status as the only partition key.
  4. Disable partitioning for large tenants.

Correct Answer: 2. Use a hierarchical partition key beginning with /tenantId and followed by a higher-cardinality property.

Explanation: Hierarchical partition keys allow Azure Cosmos DB for NoSQL to partition data across multiple levels, such as tenant and user. This helps preserve efficient tenant-based query routing while allowing a large tenant’s data to span multiple physical partitions. A single /tenantId value can otherwise become constrained by the logical-partition size limit. Low-cardinality values such as status can create hot partitions, while a fixed value would prevent effective horizontal scaling. Hierarchical partitioning is particularly useful for multitenant workloads where the first-level key matches access patterns but some tenants may grow substantially.

Q2. You need to store related order and order-line data so that all lines can be updated transactionally with the order. Which design is most appropriate when the data comfortably fits within one item?

  1. Store each line in a different Azure region.
  2. Use separate accounts for orders and order lines.
  3. Store each line under a random partition key.
  4. Embed the order lines in the order document.

Correct Answer: 4. Embed the order lines in the order document.

Explanation: Embedding related entities in a single document is often appropriate when the entities are read and updated together and share the same lifecycle. An order and its lines are a common example. A single-document update is atomic, avoids additional point reads, and simplifies application logic. Separating the data into unrelated partitions would make transactional updates more complex. The design must still consider item-size limits and update frequency. Cosmos DB modeling focuses on access patterns rather than strict relational normalization, so embedding can be preferable when the relationship is tightly coupled and duplication is acceptable.

Q3. Your application frequently needs to retrieve one customer by its known id and partition key. Which access pattern provides the lowest-cost lookup?

  1. A point read.
  2. A cross-partition SQL query.
  3. A change feed read.
  4. A stored procedure that searches the partition.

Correct Answer: 1. A point read.

Explanation: A point read uses both the item ID and partition-key value to retrieve a specific item directly. It avoids the query engine and is typically one of the most efficient Cosmos DB read operations in terms of latency and request-unit consumption. A SQL query can return the same document, but it usually costs more because query processing is involved. Change feed is intended for processing changes over time, while a stored procedure is unnecessary for a known-item lookup. Data models should make item IDs and partition keys available whenever frequent point access is required.

Q4. You are sizing an Azure Cosmos DB solution and know that traffic varies significantly throughout the day but never falls to zero. You want throughput to scale automatically according to demand. What should you configure?

  1. TTL.
  2. Continuous backup.
  3. Autoscale provisioned throughput.
  4. A unique key policy.

Correct Answer: 3. Autoscale provisioned throughput.

Explanation: Autoscale provisioned throughput allows Cosmos DB to dynamically scale RU/s within a configured range according to workload demand. It is useful when traffic fluctuates but the application still benefits from provisioned capacity and predictable performance. Manual throughput requires administrators or automation to change RU/s explicitly, while serverless is better suited to certain intermittent workloads. TTL manages item expiration, backup addresses recovery, and unique keys enforce data constraints. Sizing decisions should account for peak traffic, baseline activity, storage growth, and whether throughput is configured at the container or database level.

Q5. You are creating a Cosmos DB client for a latency-sensitive application running in Azure. Network restrictions do not prevent direct connectivity. Which mode should you generally choose?

  1. Gateway mode only.
  2. Offline mode.
  3. Analytical mode.
  4. Direct mode.

Correct Answer: 4. Direct mode.

Explanation: Direct connectivity mode is generally preferred for latency-sensitive production applications because the SDK can communicate more directly with Cosmos DB backend replicas. It typically provides better latency and throughput characteristics than gateway mode. Gateway mode uses HTTPS through a gateway endpoint and can be useful when firewall restrictions or networking requirements prevent direct connectivity. Client configuration should also include a long-lived client instance, suitable region preferences, appropriate retry handling, and sufficient connection resources. Connectivity mode is part of broader SDK tuning rather than an isolated setting.

Q6. You need to execute several item operations atomically. All affected items share the same logical partition key. Which SDK feature should you use?

  1. Bulk execution.
  2. Transactional Batch.
  3. Change feed processor.
  4. Integrated cache.

Correct Answer: 2. Transactional Batch.

Explanation: Transactional Batch groups multiple create, replace, patch, or delete operations that share a logical partition key into one atomic unit. If one operation fails, the entire batch is rolled back. This is useful when related documents need consistent updates within one transaction boundary. Bulk execution improves throughput for independent operations but does not provide a single atomic transaction across all of them. Change feed processing is asynchronous, and integrated cache accelerates eligible reads. Cosmos DB transaction boundaries are scoped to a logical partition, making partition-key design important for transactional requirements.

Q7. A document has a property named status. You need to change only that property from “pending” to “complete” while leaving the rest of the item unchanged. Which SDK operation is most appropriate?

  1. Patch the item.
  2. Delete and recreate the item.
  3. Query the item with SELECT *.
  4. Recreate the container.

Correct Answer: 1. Patch the item.

Explanation: Patch operations allow selected fields of a Cosmos DB item to be modified without replacing the entire document. This can reduce network payload and simplify code when only a few properties change. For example, the application can replace the value of /status while preserving every other property. Delete-and-create is unnecessarily disruptive, and a query does not perform the required mutation. Recreating the container would be completely inappropriate. Patch operations can also participate in transactional batches when multiple changes within the same logical partition must succeed or fail together.

Q8. Your application uses session consistency. A user’s second request may be routed to a different application instance than the first request. What should you propagate to preserve the session guarantee?

  1. The item’s TTL value.
  2. The unique key definition.
  3. The session token.
  4. The backup timestamp.

Correct Answer: 3. The session token.

Explanation: Session consistency provides read-your-writes and related ordering guarantees within a session. The SDK uses session tokens to track the relevant data version. In a distributed application where requests can be handled by different application instances, propagating the session token helps preserve those semantics across requests. TTL controls expiration, unique keys enforce constraints, and backup timestamps are unrelated to read consistency. Session consistency is often a practical balance between latency and consistency for interactive applications that need users to immediately observe their own updates.

Q9. You need to process all changes in a container and maintain a materialized projection in another container. Which feature should you use?

  1. Integrated cache.
  2. Change feed.
  3. TTL.
  4. Manual failover.

Correct Answer: 2. Change feed.

Explanation: The Cosmos DB change feed provides a stream of item changes that can be consumed by an application, Azure Function, or change feed processor. A common use case is maintaining a materialized or denormalized view in another container. This allows the transactional write path to remain focused while downstream processing updates projections asynchronously. Integrated cache optimizes reads, TTL expires documents, and failover changes regional roles. The change feed is also commonly used for notifications, event-driven workflows, replication patterns, and integration with downstream systems.

Q10. You want to ensure that two documents within the same logical partition cannot have the same combination of email and organizationId. What should you configure?

  1. A unique key policy containing both paths.
  2. A session token.
  3. A continuation token.
  4. A change feed lease.

Correct Answer: 1. A unique key policy containing both paths.

Explanation: A unique key policy can define one or more property paths whose combined values must be unique within a logical partition. Defining both email and organizationId in a unique-key constraint enforces the required combination. Unique key policies must be planned at container creation, which makes early data-model design important. Session tokens support session consistency, continuation tokens support query pagination, and lease documents coordinate change feed processing. Unique keys provide a useful integrity mechanism beyond the normal uniqueness of the id and partition-key combination.

Q11. A query orders documents first by category and then by price. What index should you evaluate?

  1. Spatial index only.
  2. TTL index.
  3. Unique key index.
  4. Composite index.

Correct Answer: 4. Composite index.

Explanation: Composite indexes are designed to support certain query patterns involving multiple properties, including multi-property ORDER BY. The paths and sort directions in the composite index should match the query pattern. A spatial index is for geographic data, while TTL and unique keys serve lifecycle and integrity purposes. Composite indexes add maintenance overhead to writes, so they should be created for important and frequently used query patterns rather than indiscriminately. Query metrics should be used to confirm that the new index actually reduces request-unit cost and improves execution behavior.

Q12. You need a SQL query to iterate through elements in an item’s tags array and return individual matching values. Which query construct should you use?

  1. TTL.
  2. Manual failover.
  3. JOIN over the array.
  4. Point-in-time restore.

Correct Answer: 3. JOIN over the array.

Explanation: Azure Cosmos DB for NoSQL SQL supports JOIN semantics for iterating over nested arrays inside a single JSON item. For example, a query can join an item with its tags array and filter or project individual tag elements. This differs from relational joins across tables; Cosmos DB joins operate within the scope of an item. TTL, failover, and restore capabilities do not provide array traversal. Understanding array querying is important because Cosmos DB documents frequently contain nested arrays and objects rather than flat relational structures.

Q13. Your application receives frequent HTTP 429 responses, but overall account RU usage looks moderate. What should you investigate first?

  1. Per-partition throughput consumption for a hot partition.
  2. The backup retention period.
  3. The number of unique keys.
  4. The account display name.

Correct Answer: 1. Per-partition throughput consumption for a hot partition.

Explanation: Throttling can occur even when total account-level RU consumption looks acceptable if requests are concentrated on one partition. A hot partition may exhaust the throughput available to that partition while other partitions remain lightly used. Monitoring per-partition RU consumption and data distribution can reveal this imbalance. If confirmed, the underlying partition-key design or workload routing may need to change. Backup settings and unique keys do not explain uneven request distribution. Partition-key quality must be evaluated based on both data distribution and throughput distribution.

Q14. Your account has one write region and multiple read regions. You want Cosmos DB to promote a new write region automatically if the current write region becomes unavailable. What should you enable?

  1. Integrated cache.
  2. TTL.
  3. Analytical store.
  4. Automatic failover.

Correct Answer: 4. Automatic failover.

Explanation: Automatic failover allows Cosmos DB to promote another configured region to become the write region if the existing write region becomes unavailable. Failover priorities determine the preferred order in single-write-region accounts. This capability improves resilience and reduces the need for manual intervention during a regional outage. Integrated cache accelerates reads, TTL manages expiration, and analytical store supports analytical workloads. Applications should also configure SDK preferred regions and test failover behavior so they understand how traffic is rerouted during outages.

Q15. A global application requires reads to lag writes by no more than a configured number of versions or time interval. Which consistency level should you select?

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

Correct Answer: 2. Bounded staleness.

Explanation: Bounded staleness provides a defined maximum lag between reads and writes, expressed as either a number of versions or a time interval. It offers stronger guarantees than eventual or consistent-prefix consistency but permits more flexibility than strong consistency. Session consistency focuses on guarantees within a client session and does not define the same global lag bound. Consistency selection affects latency, availability, and performance, so the business requirement should determine the appropriate level rather than simply choosing the strongest option.

Q16. You want to execute a large analytics workload over Cosmos DB operational data without placing equivalent query pressure on the transactional store. What should you enable?

  1. Multi-region writes.
  2. A unique key policy.
  3. Analytical store.
  4. Gateway mode.

Correct Answer: 3. Analytical store.

Explanation: Analytical store provides a column-oriented representation of Cosmos DB data optimized for large analytical workloads. This helps separate analytical processing from operational request-unit consumption on the transactional store. It can support integration with analytical services such as Microsoft Fabric or compatible Spark-based workloads. Multi-region writes address availability, unique keys enforce integrity, and gateway mode controls SDK connectivity. Analytical-store scenarios are useful when the same operational dataset must also support business intelligence, data science, or large-scale analytics.

Q17. You are using periodic backup and need to determine how frequently backups are created. Which setting should you review?

  1. The composite-index order.
  2. The session token.
  3. The consistency level.
  4. The backup interval.

Correct Answer: 4. The backup interval.

Explanation: In periodic backup mode, the backup interval controls how frequently Cosmos DB creates backups. The retention configuration determines how long those backups are retained. Together, these settings influence the recovery points available after an incident. Index configuration, session tokens, and consistency levels serve unrelated purposes. Backup design should reflect organizational recovery-point and recovery-time objectives. Periodic backup differs from continuous backup, which is designed to support point-in-time restore within its supported retention window.

Q18. You need to write Spark-transformed records directly back into the Azure Cosmos DB transactional store. Which integration should you use?

  1. Azure Cosmos DB Spark connector.
  2. Azure Monitor alert.
  3. TTL.
  4. Integrated cache.

Correct Answer: 1. Azure Cosmos DB Spark connector.

Explanation: The Azure Cosmos DB Spark connector enables Spark workloads to read from and write to the transactional store. This makes it suitable for distributed transformation, enrichment, and processing pipelines that need to persist results back into Cosmos DB. Azure Monitor alerts provide operational notifications, TTL manages expiration, and integrated cache accelerates eligible reads. Spark-based write workloads must still consider partition-key values, throughput limits, concurrency, retry behavior, and the impact of large processing jobs on production transactional traffic.

Q19. You need Azure Functions code to execute automatically when new or updated items are detected in a Cosmos DB container. Which integration should you configure?

  1. A unique key policy.
  2. Gateway mode.
  3. Azure Cosmos DB trigger for Azure Functions.
  4. A composite index.

Correct Answer: 3. Azure Cosmos DB trigger for Azure Functions.

Explanation: The Azure Cosmos DB trigger for Azure Functions is built on the change feed and invokes function code when new or updated items are available for processing. It is appropriate for serverless workflows such as notifications, denormalization, integration, aggregation, and downstream event handling. Unique keys and composite indexes are container configuration features, while gateway mode controls client connectivity. The trigger simplifies event-driven development by handling much of the underlying change feed coordination that an application would otherwise have to implement itself.

Q20. You want to receive an automated notification if server-side latency stays above an acceptable value for several minutes. Which feature should you configure?

  1. Unique key policy.
  2. Azure Monitor alert rule.
  3. Transactional Batch.
  4. Continuation token.

Correct Answer: 2. Azure Monitor alert rule.

Explanation: Azure Monitor alert rules can evaluate Cosmos DB metrics such as server-side latency and trigger actions when a threshold remains exceeded for a configured period. Action groups can send notifications or start automated remediation workflows. Unique keys enforce constraints, Transactional Batch provides atomic operations, and continuation tokens support paging. Effective production monitoring should include alerts for latency, throttling, failures, and throughput saturation so operations teams can respond before service degradation becomes a prolonged user-facing issue.