Microsoft DP-420 Practice Test Questions and Exam Dumps Part19 Q361-380

 

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


Q1. An Azure Cosmos DB for NoSQL container uses /tenantId as its partition key. An existing item must be moved from tenant A to tenant B. What should your application do?

  1. Patch the existing partition-key value.
  2. Replace the item and specify the new partition key.
  3. Change the container’s partition-key definition.
  4. Create a new item using the new partition key and remove the old item.

Correct Answer: 4. Create a new item using the new partition key and remove the old item.

Explanation: The partition-key value of an existing Cosmos DB item cannot simply be changed in place. The partition key determines the item’s logical partition and therefore its placement and routing. To move an item to another partition-key value, the application typically creates a new item containing the required data under the new key and then removes the original item. The application should consider concurrency and consistency during the move. Patch and Replace can modify document content, but they cannot migrate an existing item to a different logical partition by changing its partition-key value.

Q2. A Cosmos DB container uses /customerId as its partition key. Two customers both have an item with id equal to “profile”. Is this allowed?

  1. Yes, because the combination of id and partition-key value uniquely identifies an item.
  2. No, because id must be globally unique across the account.
  3. No, because all IDs must be GUIDs.
  4. Yes, but only if indexing is disabled.

Correct Answer: 1. Yes, because the combination of id and partition-key value uniquely identifies an item.

Explanation: In a partitioned Cosmos DB for NoSQL container, item identity is determined by the combination of the item’s id and partition-key value. Therefore, two logical partitions can contain items with the same id, provided their partition-key values differ. Within the same logical partition, however, two items cannot share the same id. This distinction is important when designing identifiers for multitenant systems. IDs do not have to be GUIDs, and indexing configuration does not determine whether duplicate IDs are permitted across different logical partitions.

Q3. You are designing a synthetic partition key that combines tenantId and a bucket number. What is the primary purpose of the bucket value?

  1. To enable Strong consistency.
  2. To enforce unique keys.
  3. To spread a high-volume tenant across more partition-key values.
  4. To enable TTL.

Correct Answer: 3. To spread a high-volume tenant across more partition-key values.

Explanation: A synthetic partition key can combine business attributes with an additional generated value, such as a bucket number, to increase cardinality and distribute a workload more evenly. This can be useful when a natural key such as tenant ID aligns well with queries but one or more tenants produce enough data or traffic to become hot. The application must know how to generate or locate the correct bucket when accessing data. Bucketing does not change consistency, TTL, or unique-key behavior. Its primary purpose is to improve storage and throughput distribution.

Q4. Several item operations must participate in one transaction. What must be true about those items in Azure Cosmos DB for NoSQL?

  1. They must all use the same id.
  2. They must belong to the same logical partition.
  3. They must all be stored in analytical store.
  4. They must use Eventual consistency.

Correct Answer: 2. They must belong to the same logical partition.

Explanation: Transactional operations in Azure Cosmos DB are scoped to a logical partition. Features such as Transactional Batch and server-side stored procedures can perform atomic work across multiple items only when those items share the same partition-key value. This makes transaction requirements an important consideration when choosing a partition key. Items do not need the same ID, and analytical store or consistency level does not expand the transactional boundary. If business operations require atomic updates to several entities, modeling those entities into the same logical partition can simplify the implementation.

Q5. A container has TTL enabled with a default value of 600 seconds. One specific item should use a different expiration period of 3,600 seconds. What should you do?

  1. Create a separate database account.
  2. Change the consistency level for that item.
  3. Add the item to a composite index.
  4. Set an item-level TTL value of 3,600 seconds.

Correct Answer: 4. Set an item-level TTL value of 3,600 seconds.

Explanation: When TTL is enabled for a container, individual items can override the container’s default expiration period by supplying their own TTL value. This is useful when most documents share a standard retention policy but particular records require a longer or shorter lifetime. Creating separate infrastructure solely for the different expiration period would be unnecessary. Consistency and indexing do not control document expiration. Item-level TTL lets lifecycle behavior remain flexible while still benefiting from automatic Cosmos DB cleanup rather than requiring custom deletion jobs.

Q6. A query should return only a scalar product name instead of complete JSON objects. Which Cosmos DB SQL form should you consider?

  1. SELECT *
  2. SELECT VALUE
  3. SELECT JOIN
  4. SELECT TTL

Correct Answer: 2. SELECT VALUE

Explanation: SELECT VALUE can project a scalar or other value directly rather than wrapping the result in an object property. For example, a query can return product names as plain values when the application does not require complete JSON objects. This can make query responses cleaner and reduce unnecessary structure in the returned payload. SELECT * returns complete items or projected objects depending on the query form. JOIN is used to work with nested arrays, and TTL is not a SQL projection keyword for this purpose.

Q7. You need a query that returns the total sales amount for each category. Which SQL feature should you use?

  1. GROUP BY with an aggregate function.
  2. A continuation token only.
  3. TTL.
  4. A Patch operation.

Correct Answer: 1. GROUP BY with an aggregate function.

Explanation: GROUP BY can group matching documents according to one or more properties, while aggregate functions such as SUM, COUNT, or AVG calculate values for each group. This is appropriate when a query needs results such as total sales by category. Continuation tokens control pagination rather than aggregation, while TTL and Patch handle lifecycle and mutation concerns. Aggregation queries can still consume significant request units when they scan many partitions, so partition-key alignment and indexing should be considered when these queries are frequent or operate over large datasets.

Q8. Your application stores locations as GeoJSON points and needs to find records within a given polygon. Which function and index category should you use?

  1. VectorDistance with a vector index.
  2. FullTextContains with a full-text index.
  3. A spatial function such as ST_WITHIN with spatial indexing.
  4. ARRAY_CONTAINS with a composite index.

Correct Answer: 3. A spatial function such as ST_WITHIN with spatial indexing.

Explanation: Cosmos DB supports geospatial data and spatial SQL functions for location-based queries. A function such as ST_WITHIN can determine whether a GeoJSON point or shape lies within another geometry, while spatial indexing improves execution efficiency. Vector search addresses semantic similarity, full-text search handles language-oriented text retrieval, and array functions operate on JSON arrays. Applications that use geographic queries should correctly represent their GeoJSON values and configure the corresponding spatial paths in the indexing policy.

Q9. You are building native text search and want query results ranked according to how relevant each document is to the user’s search terms. Which capability is relevant?

  1. TTL scoring.
  2. Unique-key ranking.
  3. Session-token ranking.
  4. Full-text scoring.

Correct Answer: 4. Full-text scoring.

Explanation: Cosmos DB’s native full-text capabilities include relevance scoring that can be used to rank documents according to how well they match a text query. Full-text search uses specialized text processing such as tokenization, stemming, and stop-word handling when configured with the appropriate full-text policy and index. This makes it better suited to relevance-oriented keyword search than ordinary scalar string comparisons. TTL, unique keys, and session tokens solve unrelated lifecycle, integrity, and consistency concerns.

Q10. You are building semantic search over text embeddings stored in Cosmos DB. Which function is used to compare a query vector with stored vectors?

  1. VectorDistance
  2. ARRAY_LENGTH
  3. DateTimeDiff
  4. IS_NULL

Correct Answer: 1. VectorDistance

Explanation: VectorDistance calculates similarity or distance between a supplied query vector and embeddings stored in Cosmos DB. Combined with a configured vector embedding policy and vector index, it supports semantic retrieval, recommendations, and retrieval-augmented generation. The closest vectors represent items that are most similar according to the configured distance metric. Array, date, and type-checking functions serve entirely different query needs. Native Cosmos DB vector search allows applications to keep operational data and embeddings together in the same database architecture.

Q11. You use latest-version change feed mode. A document is deleted. What should a consumer expect from the normal change feed?

  1. A full delete event containing the old document.
  2. The delete is not captured as a normal change event.
  3. Every previous version is returned.
  4. The feed automatically restores the document.

Correct Answer: 2. The delete is not captured as a normal change event.

Explanation: Latest-version change feed mode records creates and updates, but it does not capture deletes as change events. Once an item is deleted, it is removed from the latest-version feed. If delete detection is required while using this mode, applications can use a soft-delete pattern, such as setting a deleted flag and optionally applying TTL afterward. All versions and deletes mode is the alternative when complete delete events and intermediate versions are required.

Q12. You use latest-version change feed mode but still need downstream processors to detect deletions. Which pattern can you implement?

  1. Disable change feed.
  2. Remove the partition key.
  3. Mark the item as deleted, let the change feed capture the update, and expire it later with TTL.
  4. Enable integrated cache.

Correct Answer: 3. Mark the item as deleted, let the change feed capture the update, and expire it later with TTL.

Explanation: A common delete-detection pattern in latest-version change feed mode is soft deletion. Instead of immediately deleting the item, the application updates it with a property such as deleted: true. That update appears in the change feed and can be processed downstream. TTL can then remove the item automatically after enough time has passed for change consumers to see the marker. This pattern is useful because latest-version mode does not directly record delete events.

Q13. You need the change feed to include every update version and deletion for audit processing. Which mode should you configure?

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

Correct Answer: 1. All versions and deletes mode.

Explanation: All versions and deletes mode records creates, intermediate updates, and deletes, preserving a much richer history than latest-version mode. It is useful for audit, synchronization, and scenarios where each individual change matters. This mode requires continuous backup and only exposes changes that fall within the configured continuous-backup retention window. Latest-version mode provides only the newest version of created or updated items and does not capture normal deletes.

Q14. A change feed pull-model consumer in all versions and deletes mode stores a continuation token. How long can that token remain useful?

  1. Forever, even after the container is deleted.
  2. It is valid only while the referenced changes remain within the continuous-backup retention window.
  3. Exactly one hour.
  4. Only until the next item is inserted.

Correct Answer: 2. It is valid only while the referenced changes remain within the continuous-backup retention window.

Explanation: In all versions and deletes mode, change history is tied to the continuous-backup retention window. A pull-model continuation token can resume processing only while the corresponding changes remain available within that retention period. This differs from latest-version mode, where continuation tokens remain usable for the lifetime of the container. Applications using all versions and deletes mode should therefore avoid leaving processors inactive beyond the relevant retention window if complete processing history is required.

Q15. You need serverless code to process all versions and deletes change feed events. Which design requirement should you verify?

  1. The correct Azure Functions Cosmos DB extension and supported programming model are being used.
  2. Integrated cache is enabled.
  3. Every document has the same ID.
  4. The account uses Eventual consistency.

Correct Answer: 1. The correct Azure Functions Cosmos DB extension and supported programming model are being used.

Explanation: Azure Functions can consume Cosmos DB change feed events, including all versions and deletes mode when the appropriate supported extension and programming model are used. The account must also have continuous backup enabled and the all versions and deletes change feed feature turned on. Integrated cache, IDs, and Eventual consistency are not the enabling requirements. When using evolving platform features, developers should verify SDK or Functions extension compatibility as part of the solution design.

Q16. You need a change feed pull-model consumer to process only a specific range of partition-key values. What should you provide?

  1. A TTL policy.
  2. A unique key.
  3. A FeedRange.
  4. A vector policy.

Correct Answer: 3. A FeedRange.

Explanation: The change feed pull model supports reading changes from a specific feed range. A FeedRange represents a range of partition-key values and allows an application to divide change processing explicitly across workers or custom processing units. This gives developers more control than the higher-level change feed processor, which manages leases and balancing automatically. TTL, unique keys, and vector policies serve unrelated lifecycle, integrity, and search requirements. The pull model is most useful when custom scheduling and ownership logic justify the added complexity.

Q17. Your account uses multiple read regions and one write region. You want a planned maintenance operation to move the write region intentionally. What should you perform?

  1. Integrated-cache refresh.
  2. TTL reset.
  3. Index transformation.
  4. Manual failover.

Correct Answer: 4. Manual failover.

Explanation: Manual failover allows administrators to intentionally move the write role to another configured region in an account that uses a single write region. This is useful for planned maintenance, operational testing, and disaster-recovery exercises. Automatic failover serves a different purpose by promoting another region when a write-region outage occurs according to configured priorities. Cache, TTL, and indexing do not change regional write ownership. Failover procedures should be tested together with application preferred-region settings and operational runbooks.

Q18. You need to compare Cosmos DB server-side processing latency with total application-observed latency. Why is this useful?

  1. It helps determine whether delays are inside Cosmos DB or in client/network processing.
  2. It changes the partition key automatically.
  3. It enables point-in-time restore.
  4. It disables 429 responses.

Correct Answer: 1. It helps determine whether delays are inside Cosmos DB or in client/network processing.

Explanation: Server-side latency measures the time Cosmos DB spends processing a request within the service. End-to-end application latency also includes network transit, client connection handling, retries, thread scheduling, serialization, and application processing. Comparing the two helps identify where the delay is actually occurring. If server latency is low but application latency is high, client or network issues should be investigated using SDK diagnostics and application telemetry. This comparison does not alter partitioning, backup, or throttling behavior.

Q19. You want application and Cosmos DB resource logs to be analyzed together using Kusto Query Language. What should you configure?

  1. TTL.
  2. Azure Monitor diagnostic settings that send Cosmos DB logs to Log Analytics.
  3. A stored procedure.
  4. Integrated cache.

Correct Answer: 2. Azure Monitor diagnostic settings that send Cosmos DB logs to Log Analytics.

Explanation: Azure Monitor diagnostic settings can route Cosmos DB resource logs to a Log Analytics workspace. Once centralized, Kusto Query Language can be used to analyze database activity alongside application, network, and other Azure telemetry. This is useful for performance troubleshooting, auditing, security analysis, and incident investigation. TTL, stored procedures, and cache do not provide centralized operational logging. Correlation identifiers in application telemetry can further improve the ability to match Cosmos DB requests with user-facing operations.

Q20. You need an alert when Cosmos DB server-side latency stays above the application’s service objective for five minutes. Which solution should you implement?

  1. A unique key policy.
  2. TTL.
  3. An Azure Monitor alert rule using the latency metric and an action group.
  4. A query continuation token.

Correct Answer: 3. An Azure Monitor alert rule using the latency metric and an action group.

Explanation: Azure Monitor alerts can evaluate Cosmos DB service metrics against defined thresholds and time windows. A latency alert can detect when server-side processing remains above the application’s service objective rather than reacting to a single short-lived spike. An action group can notify operations staff or trigger automated workflows. Unique keys, TTL, and continuation tokens do not provide operational alerting. Effective monitoring should use thresholds that are meaningful for the application’s normal workload and should complement alerts for throttling, failures, availability, and partition-level resource pressure.