Launch pricing — Azure certification prep for €19,95 €29,95

← All DP-900 topicsDP-900 · Non-Relational Data on Azure

DP-900 Azure Cosmos DB Practice Questions

Azure Cosmos DB is a globally distributed, multi-model NoSQL database. The DP-900 asks when to use it, and which API fits which workload: NoSQL, MongoDB, PostgreSQL, Apache Cassandra, Apache Gremlin for graphs, and Table.

Expect questions on partition keys, request units, multi-region writes, the consistency levels from strong to eventual, and features such as the change feed and Azure Synapse Link for analytics on operational data.

Below are 12 free questions on this topic. Try each one before you open the answer.

Question 1

A team is choosing between Azure Table Storage and Azure Cosmos DB for a new application. Which statement correctly describes a key advantage of Azure Cosmos DB over Azure Table Storage?

  • A.Azure Table Storage offers more consistency levels than Cosmos DB
  • B.Azure Cosmos DB provides global distribution, multiple APIs, and configurable consistency levels
  • C.Azure Table Storage supports the Gremlin graph API natively
  • D.Azure Cosmos DB can only be used with the Table API
chevron_rightShow answer and explanation

Correct answer: B. Azure Cosmos DB provides global distribution, multiple APIs, and configurable consistency levels

Azure Cosmos DB is a fully managed, globally distributed NoSQL database that offers multiple APIs (Core SQL, MongoDB, Cassandra, Gremlin, Table), five configurable consistency levels, and low-latency SLAs worldwide. Azure Table Storage is simpler and cheaper but lacks global distribution guarantees, multiple APIs, and advanced consistency options. Cosmos DB Table API is backward-compatible with Azure Table Storage.

Question 2

A globally distributed application requires that every read always returns the most recently committed write, regardless of which region serves the request. Which Azure Cosmos DB consistency level should be configured?

  • A.Eventual
  • B.Session
  • C.Consistent Prefix
  • D.Strong
chevron_rightShow answer and explanation

Correct answer: D. Strong

Strong consistency guarantees that reads always return the most recently committed write — the equivalent of linearizability. This is the strictest consistency level in Cosmos DB and comes at the cost of higher latency and lower availability in multi-region deployments. Eventual consistency offers the lowest latency but may return stale data. Session and Consistent Prefix offer intermediate trade-offs.

Question 3

A global application requires low read latency in multiple regions and needs to allow writes in all deployed regions simultaneously. Which Azure Cosmos DB capability enables this?

  • A.Single-region writes with read replicas
  • B.Multi-region writes (multi-master)
  • C.Geo-redundant backup
  • D.Availability zone support
chevron_rightShow answer and explanation

Correct answer: B. Multi-region writes (multi-master)

Azure Cosmos DB supports multi-region writes, also called multi-master, allowing writes to be performed in any configured region. This minimizes write latency for users worldwide and provides higher availability. Conflict resolution policies handle cases where the same item is written concurrently in multiple regions. Single-region writes (with read replicas) only allow writes in one region, increasing write latency for users far from that region.

Question 4

Which Azure Cosmos DB consistency level offers the lowest latency and highest throughput, but provides no ordering or freshness guarantees?

  • A.Strong
  • B.Bounded Staleness
  • C.Session
  • D.Eventual
chevron_rightShow answer and explanation

Correct answer: D. Eventual

Eventual consistency is the weakest of the five Cosmos DB consistency levels. It offers the lowest read latency and highest throughput because reads are served from the nearest replica without waiting for synchronization. However, there are no guarantees on ordering or freshness — reads may return stale or out-of-order data. It is appropriate for use cases like displaying social media like counts, where slight inconsistency is acceptable.

Question 5

Which Azure Cosmos DB consistency level provides the strongest data consistency guarantee and ensures that reads always return the most recently committed write?

  • A.Session
  • B.Bounded Staleness
  • C.Strong
  • D.Consistent Prefix
chevron_rightShow answer and explanation

Correct answer: C. Strong

Strong consistency guarantees linearizability: every read always returns the most recent committed write. Reads are served from the write quorum or after synchronous replication. The trade-off is higher latency and higher RU consumption compared to weaker consistency levels. Strong consistency also cannot be used with multi-region writes configured. It is most appropriate for scenarios where data accuracy is critical and read latency is a secondary concern.

Question 6

A team runs a query in Azure Cosmos DB that scans thousands of items across multiple partitions to return 10 results. Compared to a targeted single-partition query returning the same 10 results, how does the cross-partition query affect RU consumption?

  • A.RU consumption is identical because the result set size is the same
  • B.RU consumption is lower because Cosmos DB caches cross-partition results
  • C.RU consumption is higher because more data must be scanned and more partitions contacted
  • D.RU consumption is lower because parallelism reduces the per-item cost
chevron_rightShow answer and explanation

Correct answer: C. RU consumption is higher because more data must be scanned and more partitions contacted

Query RU cost is driven by the number of items scanned (not just returned) and the number of partitions involved. A cross-partition query that fans out to multiple partitions must contact each partition and process all candidate documents before filtering and returning results. This significantly increases RU consumption. Designing a good partition key that keeps related queries within a single partition is a key Cosmos DB performance optimization.

Question 7

A developer wants to run a query in Azure Cosmos DB that uses ORDER BY on two properties: `category` and `timestamp`. The query is returning an error stating that a composite index is required. What must the developer configure?

  • A.Increase the provisioned RU/s to support the sort operation
  • B.Add a composite index on (category, timestamp) to the container's indexing policy
  • C.Change the partition key to include both category and timestamp
  • D.Switch the consistency level to Strong to enable multi-property sorting
chevron_rightShow answer and explanation

Correct answer: B. Add a composite index on (category, timestamp) to the container's indexing policy

Azure Cosmos DB requires a composite index when an ORDER BY clause references more than one property. Single-property sort queries can use the default index, but multi-property ORDER BY (e.g., ORDER BY c.category ASC, c.timestamp DESC) requires a composite index explicitly defined in the indexing policy with the matching properties and sort orders. Without it, Cosmos DB will reject the query with an index error.

Question 8

A team wants to use the Azure Cosmos DB change feed to keep a separate search index in sync with data changes. Which statement about the change feed is correct?

  • A.The change feed only captures the final state of items after batch operations complete
  • B.The change feed is ordered per partition key and can be read by multiple independent consumers simultaneously
  • C.The change feed captures all operations including deletes by default
  • D.The change feed is only available in Cosmos DB accounts with multi-region writes enabled
chevron_rightShow answer and explanation

Correct answer: B. The change feed is ordered per partition key and can be read by multiple independent consumers simultaneously

The Cosmos DB change feed maintains changes in the order they occurred within each logical partition. Multiple independent consumers (for example, different Azure Functions or microservices) can read the change feed at their own pace using separate leases, without interfering with each other. This makes it well suited for fan-out patterns — one data change can trigger a search index update, a notification service, and an analytics pipeline all at the same time. Delete operations are not captured by default; the feed reflects inserts and updates only in the default mode.

Question 9

A company stores order data in Azure Cosmos DB using the Core (SQL) API. They want to run complex analytical queries against this data in Azure Synapse Analytics without impacting the transactional performance of their Cosmos DB account. Which feature makes this possible?

  • A.Azure Data Factory with a Cosmos DB linked service and a scheduled copy pipeline
  • B.Azure Synapse Link for Azure Cosmos DB, using the analytical store
  • C.A Cosmos DB read replica configured for analytical workloads
  • D.PolyBase pointed directly at the Cosmos DB transactional store
chevron_rightShow answer and explanation

Correct answer: B. Azure Synapse Link for Azure Cosmos DB, using the analytical store

Azure Synapse Link for Cosmos DB enables HTAP by automatically syncing data from the Cosmos DB transactional store to a separate column-oriented analytical store. Analytical queries in Synapse (via serverless SQL or Apache Spark) read from the analytical store, so they do not consume RUs from or compete with the transactional store. Unlike ADF, there is no pipeline to build or schedule — the sync happens continuously and automatically.

Question 10

A startup builds a product recommendation engine that models relationships between users, products, and purchase events as a graph. They need to traverse multi-hop relationships (e.g., "users who bought X also bought Y") efficiently. Which Azure Cosmos DB API is the best fit?

  • A.Core (SQL) API
  • B.Cassandra API
  • C.Gremlin API
  • D.Table API
chevron_rightShow answer and explanation

Correct answer: C. Gremlin API

The Gremlin API in Cosmos DB is designed for graph data models, where entities are vertices and relationships are edges. Traversing multi-hop connections (e.g., friend-of-a-friend, product co-purchase relationships) is the core strength of graph databases. Gremlin is the industry-standard graph traversal language. The Core (SQL) API stores JSON documents and is suited for hierarchical or flat data, not graph traversal. The Cassandra API provides a wide-column store model suited for time-series and sensor data. The Table API is a key-value store — the simplest API with no relationship traversal capability.

Question 11

A startup is building a catalog service where users can browse millions of products stored in an existing MongoDB database. They want to move to Azure and continue using MongoDB drivers and queries without rewriting application code. Which Azure service allows this?

  • A.Azure Cosmos DB for MongoDB
  • B.Azure SQL Database with JSON support
  • C.Azure Table Storage
  • D.Azure Cosmos DB for NoSQL (Core API)
chevron_rightShow answer and explanation

Correct answer: A. Azure Cosmos DB for MongoDB

Azure Cosmos DB for MongoDB provides wire-protocol compatibility with MongoDB, meaning existing applications using MongoDB drivers (e.g., the official MongoDB Node.js, Python, or Java drivers) can connect to Cosmos DB without code changes. MongoDB Query Language (MQL) queries work as-is. This is Microsoft's recommended path for MongoDB workloads moving to Azure. The Core (SQL) API uses a different query language and SDK — not MongoDB-compatible. Azure SQL Database with JSON columns requires rewriting all data access code from MQL to T-SQL. Azure Table Storage is a simple key-value store with no document querying capability.

Question 12

Azure Cosmos DB uses ___ and partitioning to provide fast read and write performance and can scale to massive volumes of data.

  • A.replication logs
  • B.indexes
  • C.foreign keys
  • D.stored procedures
chevron_rightShow answer and explanation

Correct answer: B. indexes

Cosmos DB automatically creates and maintains indexes alongside partitioning to deliver fast read and write performance at scale. Replication logs (A) are an internal mechanism but not the performance feature described. Foreign keys (C) are a relational database concept not present in Cosmos DB. Stored procedures (D) are a relational concept and, while Cosmos DB supports server-side JavaScript, they are not the mechanism described here.

These are 12 of 53 Azure Cosmos DB questions in the full bank

Practice all 400 DP-900 questions in exam format, including drag-and-drop and multi-select questions, with a mock exam and progress tracking.