Microsoft DP-420 Practice Test Questions and Exam Dumps Part18 Q341-360

 

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


Q1. You are designing an Azure Cosmos DB for NoSQL workload that stores IoT devices and their configuration history. Most requests retrieve all configuration versions for a specific device. Which partition key is the best starting choice?

  1. /firmwareVersion
  2. /status
  3. /deviceId
  4. /lastUpdatedMonth

Correct Answer: 3. /deviceId

Explanation: The partition key should align with the dominant access pattern while distributing storage and throughput effectively. If the application normally retrieves configuration history for one device, /deviceId allows those requests to target a specific logical partition rather than fan out across many partitions. Properties such as status or firmware version may have relatively low cardinality and create hotspots. A month-based key can distribute writes but would scatter one device’s configuration history across partitions. Partition design should consider query routing, data volume per key, transaction requirements, and expected request-unit distribution as the workload grows.

Q2. You are building a Cosmos DB application and need local development without consuming Azure cloud resources. Which option is most appropriate?

  1. Azure Cosmos DB emulator
  2. Azure Monitor
  3. Azure Event Hubs
  4. Microsoft Fabric Warehouse

Correct Answer: 1. Azure Cosmos DB emulator

Explanation: The Azure Cosmos DB emulator provides a local environment for developing and testing Cosmos DB applications without requiring a live Azure Cosmos DB account. It is useful for learning SDK behavior, validating application logic, and running automated development tests. Azure Monitor provides observability, Event Hubs is an event-streaming platform, and Fabric Warehouse supports analytics. The emulator does not reproduce every cloud characteristic, such as true global distribution or production network latency, so important deployment and performance scenarios should still be validated against an actual Azure account before production release.

Q3. An application frequently creates or updates the same logical item and does not need to distinguish between an insert and a replacement. Which SDK operation should you use?

  1. Read Item
  2. Delete Item
  3. Patch Item only
  4. Upsert Item

Correct Answer: 4. Upsert Item

Explanation: Upsert Item combines create and replace behavior. If an item with the specified ID and partition key does not exist, Cosmos DB creates it. If it already exists, the item is replaced. This is useful when the application does not need separate insert and replacement paths. Create Item would fail if the identity already existed, while Patch only modifies selected properties of an existing item. Upsert should be used carefully because an existing document can be overwritten when the same identity is supplied. The application should still use appropriate concurrency controls when simultaneous updates are possible.

Q4. A query needs to return the number of documents for each category. Which Cosmos DB SQL feature should you use?

  1. Vector search
  2. Aggregate functions such as COUNT
  3. TTL
  4. Transactional Batch

Correct Answer: 2. Aggregate functions such as COUNT

Explanation: Cosmos DB for NoSQL SQL supports aggregate functions such as COUNT, SUM, AVG, MIN, and MAX. These functions allow calculations to be performed by the query engine rather than requiring the application to retrieve every document and aggregate values locally. Grouping and aggregation should still be evaluated for RU cost, particularly when the query spans multiple partitions. Vector search is intended for similarity queries, TTL controls document expiration, and Transactional Batch manages atomic item operations within a logical partition. Aggregate queries are useful for summaries, counts, and operational reporting.

Q5. Your account uses multiple write regions. Two regions update the same item at almost the same time. The business requires custom logic to merge the competing versions. What should you configure?

  1. TTL
  2. Integrated cache
  3. A continuation token
  4. A custom conflict-resolution policy

Correct Answer: 4. A custom conflict-resolution policy

Explanation: Multi-region writes can produce conflicts when concurrent updates affect the same logical item. If the default conflict-resolution strategy does not match business requirements, a custom conflict-resolution policy can apply domain-specific logic to determine the final state. Conflict handling should be designed before enabling globally distributed writes because it affects correctness under concurrency. TTL manages expiration, integrated cache improves eligible reads, and continuation tokens represent query paging state. A deterministic and well-tested conflict strategy is essential when several regions are allowed to accept writes simultaneously.

Q6. You need to calculate the square of a numeric property directly in a Cosmos DB SQL query. Which capability should you use?

  1. A mathematical SQL function
  2. A change feed lease
  3. A unique key
  4. Automatic failover

Correct Answer: 1. A mathematical SQL function

Explanation: Cosmos DB SQL includes built-in mathematical functions that can evaluate numeric expressions directly within queries. This can reduce the need to retrieve documents only to perform simple calculations in application code. Mathematical functions are useful in projections, filters, and derived values. Change feed leases coordinate processors, unique keys enforce data-integrity constraints, and automatic failover changes regional write roles during outages. Query-side calculations should still be tested for RU cost, especially when they are applied to large cross-partition datasets or when predicates cannot efficiently reduce the number of examined items.

Q7. You need to perform a query that references a value from the outer query inside an inner subquery over a nested array. Which SQL concept is required?

  1. TTL
  2. Point read
  3. Correlated subquery
  4. Manual failover

Correct Answer: 3. Correlated subquery

Explanation: A correlated subquery references values from the outer query while evaluating the inner expression. This can be useful when querying nested arrays or objects and the inner condition depends on the current outer document. Cosmos DB SQL supports document-oriented query patterns that differ from traditional relational joins between independent tables. TTL and failover are operational settings, while a point read retrieves one known item. Correlated subqueries are part of efficient JSON querying and are especially useful when the relationship being evaluated exists within the structure of a single document.

Q8. You need to retrieve query results in pages of approximately 100 items. Which SDK option should you configure?

  1. Item TTL
  2. Maximum item count in query request options
  3. Unique key policy
  4. Conflict policy

Correct Answer: 2. Maximum item count in query request options

Explanation: Query request options can specify the maximum number of items the SDK attempts to return in one page. This helps applications control response size, memory usage, and API pagination behavior. Continuation tokens can then be used to retrieve later pages. The setting does not guarantee that every page contains exactly that number because service execution can return fewer items. TTL controls expiration, unique keys enforce constraints, and conflict policies govern concurrent multi-region updates. Page sizing should be chosen according to application responsiveness, RU consumption, network payload, and downstream processing requirements.

Q9. You want to ensure that writes fail if the document has changed since the client last retrieved it. Which mechanism should you implement?

  1. ETag-based optimistic concurrency
  2. Analytical store
  3. TTL
  4. Change feed estimator

Correct Answer: 1. ETag-based optimistic concurrency

Explanation: ETags provide a version identifier for Cosmos DB items. An application can retain the ETag from a read and send it with a conditional update. If another writer changed the item in the meantime, the ETag is different and the update can be rejected. This prevents an older client from silently overwriting newer changes without requiring pessimistic locking. Analytical store is designed for analytics, TTL controls retention, and the change feed estimator measures processing backlog. Optimistic concurrency is valuable in distributed systems where simultaneous edits to the same item can occur.

Q10. You need to store product embeddings and rank products by semantic similarity. Which combination is required?

  1. Unique keys and TTL
  2. Spatial index and ST_DISTANCE
  3. Composite index and ORDER BY
  4. Vector policy, vector index, and vector-distance querying

Correct Answer: 4. Vector policy, vector index, and vector-distance querying

Explanation: Native vector search in Cosmos DB uses a vector policy to describe the embedding path, vector dimensions, data type, and similarity metric. A vector index improves search performance, while a vector-distance function can rank stored embeddings relative to a query vector. This is useful for semantic search, recommendation systems, and retrieval-augmented generation. Spatial indexes solve geographic queries, while composite indexes target scalar filtering and ordering. The embedding model and Cosmos DB vector configuration must agree on dimensions and distance semantics for meaningful similarity results.

Q11. A container receives many writes, and a large debugPayload property is never queried. Which optimization should you evaluate?

  1. Add a full-text index to debugPayload.
  2. Exclude debugPayload from the indexing policy.
  3. Use debugPayload as the partition key.
  4. Add a unique key to the property.

Correct Answer: 2. Exclude debugPayload from the indexing policy.

Explanation: Indexing every property increases the work required for each write. If a large property is never used in queries, sorting, search, or other index-dependent operations, excluding that path can reduce write RU consumption and index storage. Adding extra indexes would have the opposite effect. Making an unqueried diagnostic payload the partition key would not align with access patterns, and a unique key would introduce an integrity constraint rather than optimize write performance. Indexing strategies should be based on actual read and write behavior, not on a blanket assumption that every field must be indexed.

Q12. You want application code to process container changes without the framework automatically managing leases. You need explicit control over feed ranges and read timing. Which option should you use?

  1. Integrated cache
  2. Stored procedure
  3. Change feed pull model
  4. Analytical store

Correct Answer: 3. Change feed pull model

Explanation: The change feed pull model gives the application explicit control over when change feed pages are requested and which feed ranges are processed. This is appropriate for specialized consumers that require custom scheduling, checkpointing, or partition-management behavior. The change feed processor provides more automation by managing leases and balancing work across instances, so it is often easier for standard scenarios. Integrated cache improves reads, stored procedures provide server-side transactional logic, and analytical store serves analytical workloads. The pull model trades convenience for greater consumer control.

Q13. You need to ensure that all changes to a source container are asynchronously reflected in a denormalized read-optimized container. Which feature should you use?

  1. Integrated cache
  2. TTL
  3. Transactional Batch across containers
  4. Change feed processing

Correct Answer: 4. Change feed processing

Explanation: Change feed processing is a common method for maintaining denormalized projections. A source write completes independently, and a downstream processor reacts to the change and updates a read-optimized document or container. This allows multiple data representations to be optimized for different access patterns while avoiding expensive synchronous cross-container logic. The derived projection will usually be eventually consistent, so monitoring processor lag is important. Integrated cache is not durable storage, TTL manages expiration, and Transactional Batch does not provide an atomic transaction across separate containers.

Q14. You need to move Cosmos DB operational data into Microsoft Fabric with minimal custom pipeline development. Which feature should you evaluate?

  1. TTL
  2. Cosmos DB Mirroring for Microsoft Fabric
  3. Integrated cache
  4. A JavaScript UDF

Correct Answer: 2. Cosmos DB Mirroring for Microsoft Fabric

Explanation: Cosmos DB Mirroring for Microsoft Fabric provides a managed path for making operational Cosmos DB data available for analytical workloads in Fabric without requiring a traditional custom ETL pipeline for replication. This can simplify architectures where application data needs to feed reporting, warehousing, or broader analytics. TTL manages retention, integrated cache optimizes application reads, and UDFs extend query logic. Mirroring should be compared with the Spark connector depending on whether the requirement is managed analytical replication or direct programmatic read and write access from Spark.

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

  1. Azure Cosmos DB Spark connector
  2. Azure Monitor
  3. Analytical store time travel
  4. Periodic backup

Correct Answer: 1. Azure Cosmos DB Spark connector

Explanation: The Azure Cosmos DB Spark connector supports direct Spark interaction with the transactional store, including supported read and write operations. This makes it appropriate for distributed enrichment, transformation, migration, or data-processing jobs that need to persist results back to Cosmos DB. Analytical store is intended for analytics and does not replace transactional writes. Azure Monitor provides observability, and periodic backup supports recovery. Spark jobs should be tuned to available throughput and partition distribution so large processing workloads do not overwhelm production traffic.

Q16. A multi-region application can tolerate stale data but must never observe writes out of order. Which consistency level should you select?

  1. Eventual
  2. Strong
  3. Consistent prefix
  4. Session

Correct Answer: 3. Consistent prefix

Explanation: Consistent Prefix ensures that reads observe writes in the same order they were committed, even though the reader may temporarily see an older prefix of the write sequence. This is useful when some staleness is acceptable but out-of-order observations would violate application logic. Eventual consistency provides weaker ordering guarantees, Session provides stronger behavior within a client session, and Strong consistency guarantees the latest committed state. Choosing a consistency level should reflect the actual correctness requirements because stronger guarantees can introduce latency, availability, or throughput tradeoffs.

Q17. An account uses one write region and several read regions. You want Cosmos DB to automatically move the write role if the active write region fails. Which feature should you configure?

  1. Integrated cache
  2. Automatic failover
  3. TTL
  4. Vector search

Correct Answer: 2. Automatic failover

Explanation: Automatic failover enables Cosmos DB to promote another configured region to the write role when the current write region becomes unavailable in a single-write-region account. Failover priorities determine the order in which regions are considered. This improves resilience and reduces the need for manual intervention during an outage. Integrated cache, TTL, and vector search do not affect regional write-role management. Applications should also configure preferred regions and test failover behavior to verify that client routing and operational procedures function as expected.

Q18. You need to recover one accidentally deleted container from a specific time yesterday. Continuous backup is enabled. What should you do?

  1. Restore the affected container from an appropriate point-in-time restore point.
  2. Rebuild the index and wait for the data to return.
  3. Enable integrated cache.
  4. Change the consistency level.

Correct Answer: 1. Restore the affected container from an appropriate point-in-time restore point.

Explanation: Continuous backup enables point-in-time restore within the supported retention window. For an accidentally deleted container, administrators should identify a time immediately before the deletion and restore the affected resource according to the supported recovery process. Index rebuilding, caching, and consistency changes cannot recreate deleted documents. Recovery should also include validation of the restored data and careful application cutover. Backup strategies are useful only when restoration procedures and restore-point identification are understood before an actual incident occurs.

Q19. You need to detect whether data is distributed unevenly across physical partitions even though RU utilization appears normal. Which metric or view should you inspect?

  1. Only server-side latency
  2. Backup history
  3. Data distribution across partitions
  4. Only HTTP 429 counts

Correct Answer: 3. Data distribution across partitions

Explanation: Monitoring data distribution across partitions helps reveal storage skew caused by the partition-key strategy. A workload can have balanced RU consumption at a particular moment while still storing an uneven amount of data across partitions. Significant storage imbalance may eventually create capacity or scaling problems and can indicate that some partition-key values dominate the dataset. Server-side latency and 429 counts measure different operational concerns. Teams should monitor both data distribution and throughput distribution because healthy partitioning requires balance in both dimensions.

Q20. You want an operations team to be notified when server-side latency remains above a defined threshold. Which capability should you configure?

  1. Azure Monitor alert rule with an action group
  2. Unique key policy
  3. TTL
  4. Stored procedure

Correct Answer: 1. Azure Monitor alert rule with an action group

Explanation: Azure Monitor alert rules can evaluate Cosmos DB metrics such as server-side latency over a defined time window and trigger an action group when the threshold is breached. The action group can send notifications or invoke automation. This supports proactive operations instead of waiting for users to report performance problems. Unique keys, TTL, and stored procedures do not provide monitoring or notification behavior. Effective Cosmos DB alerting should cover important reliability indicators such as latency, throttling, failed requests, and partition-level throughput pressure.