SaveMyCert
Log in
5 of 5 free questions left today·for 10 a day
AI-200 · Domain 2

Develop AI solutions by using Azure data management services practice questions

Develop AI solutions by using Azure data management services is worth 28% of the AI-200 exam — the heaviest of the 4 domains. The data layer of AI apps: Azure Cosmos DB for NoSQL (SDK queries, RUs, indexing, consistency, vector search, change feed), Azure Database for PostgreSQL (schemas, pgvector indexing, compute sizing, RAG with metadata filters, connections) and Azure Managed Redis (caching and vector indexing). Official weighting 25–30%. 6 fully worked examples are further down this page, answers included.

Exam weight
28%
the heaviest of the 4 domains
Questions
112
across 4 topics
Free, no account
5/day
a free account allows 10 a day
Explanations
Every option
right and wrong

Build a practice session

5 free questions left today.

Domains

How many?

Mode

Ready when you are

10 fresh questions drawn across 1 of 4 domains, in Learn mode.

Review what you missed

Every question you answer incorrectly, and every question you flag while practising, is saved here automatically. Finish a session and you can come back to re-drill just those.

6 sample Develop AI solutions by using Azure data management services questions, fully explained

Questions from the AI-200 bank mapped to domain 2, with the answer key and the reasoning behind every option. None of them repeat the examples on the main AI-200 practice page.

Question 1Develop AI solutions by using Azure data management services

A chat application stores each conversation as one item in an Azure Cosmos DB for NoSQL container partitioned on /userId. When a user opens a conversation, the app already knows the conversation's id and the user's ID. The team wants the lowest RU charge and latency for this lookup. Which Python SDK call should the app use?

Choose one.

  • a
    container.query_items(query=by_id, parameters=params, partition_key=user_id)

    A single-partition query by id returns the right item, but the query engine still runs and charges more RU than a point read.

  • b
    container.query_items(query=by_id, parameters=params, enable_cross_partition_query=True)

    This fans the query out across partitions even though the partition key is known, so it costs more than both the point read and a scoped query.

  • c
    container.query_items_change_feed(partition_key=user_id, start_time='Beginning')

    The change feed returns the history of changes in the partition, not a direct lookup of one item, and would read far more data.

  • d
    container.read_item(item=conversation_id, partition_key=user_id) Correct

    A point read addresses one item by id and partition key directly, which is the cheapest and fastest way to fetch a single known item (about 1 RU for a 1 KB item).

The concept

When both the id and the partition key are known, a point read is cheaper than any query.

Why that’s the answer

read_item sends a direct request to the item's logical partition by id, so no query plan or index lookup is needed. Microsoft documents point reads as costing about 1 RU for a 1 KB item. A query with WHERE c.id = @id returns the same item but costs more because the query engine runs. A cross-partition query or a change feed read wastes even more RU.

How to reason it out
  1. Check what the app knows: the item id and the partition key value.
  2. With both values, the item can be addressed directly without a query.
  3. Choose the point read; reserve queries for lookups that need filters or several items.

Exam tip: Known id + partition key = read_item point read, the lowest-RU way to fetch one item.

AI-200 Azure Cosmos DB for NoSQL: SDK Queries, RUs, Vector Search and Change Feed — the lesson that teaches this.

Question 2Develop AI solutions by using Azure data management services

A RAG service stores chat messages in a Cosmos DB for NoSQL container partitioned on /userId. The code below must return one session's messages for the signed-in user. The query must run in a single logical partition and must not be open to injection through the session ID, which comes from the request.q = "SELECT * FROM c WHERE c.sessionId = @sid" items = container.query_items( # missing line )Which line completes the call?

Choose one.

  • a
    query=q, parameters=[{"name": "@sid", "value": sid}], partition_key=sid

    The container is partitioned on /userId. Passing the session ID as the partition key targets a partition that holds none of the user's messages.

  • b
    query=q.replace("@sid", repr(sid)), partition_key=user_id

    Splicing request input into the query text is exactly the injection risk the requirement rules out, even though the partition key is right.

  • c
    query=q, parameters=[{"name": "@sid", "value": sid}], partition_key=user_id Correct

    The parameters list binds @sid safely, and partition_key targets the signed-in user's logical partition, so the query stays single-partition.

  • d
    query=q, parameters=[{"name": "@sid", "value": sid}], enable_cross_partition_query=True

    The parameter binding is safe, but without a partition key the query fans out to every partition and costs more RU.

The concept

query_items takes a parameters list of name/value dictionaries and a partition_key that scopes the query to one logical partition.

Why that’s the answer

Two requirements decide the answer. Injection safety needs the value passed through parameters rather than concatenated into the SQL text. Single-partition execution needs partition_key set to the container's partition key value, here the user's ID. Only the keyed line does both: one distractor uses the wrong value for the partition key, one is unsafe, and one fans out across partitions.

How to reason it out
  1. Find the container's partition key path (/userId) and the value that matches it (user_id).
  2. Pass request-supplied values through parameters, never string concatenation.
  3. Set partition_key so the SDK sends the query to one logical partition.

Exam tip: Safe and cheap queries: bind values with parameters=[{name, value}] and scope with partition_key.

AI-200 Azure Cosmos DB for NoSQL: SDK Queries, RUs, Vector Search and Change Feed — the lesson that teaches this.

Question 3Develop AI solutions by using Azure data management services

A product search query in a Python app costs far more RUs than expected. The developer wants the SDK to report which indexed paths the query used and which single or composite indexes might lower its cost, so the indexing policy can be tuned. What should the developer do?

Choose one.

  • a
    Pass populate_query_metrics=True and read the x-ms-documentdb-query-metrics header

    Query metrics break down execution time and documents loaded, but they do not list utilised or recommended indexes.

  • b
    Pass populate_index_metrics=True and read the x-ms-cosmos-index-utilization header Correct

    Index metrics return the utilised single and composite indexes and the potential ones that could reduce the query's RU charge.

  • c
    Read x-ms-request-charge from last_response_headers after iterating the results

    The request charge confirms the cost but says nothing about which indexes were used or could help.

  • d
    Send diagnostic logs to Log Analytics and query the CDBDataPlaneRequests table

    Data plane request logs show operations, status codes and charges, not index recommendations for a specific query.

The concept

Index metrics (populate_index_metrics in Python) report utilised and potential indexed paths for a query.

Why that’s the answer

In the Python SDK, passing populate_index_metrics=True to query_items makes the service return the x-ms-cosmos-index-utilization header, which lists utilised single and composite indexes and potential ones with an impact score. That is the input needed to change the indexing policy. Query metrics and the request charge describe cost and execution, not indexes, and request logs work at the operation level. Microsoft recommends enabling index metrics only while troubleshooting.

How to reason it out
  1. Identify the information needed: which indexes the query used and which could help.
  2. Match it to the feature that reports utilised and potential indexes: index metrics.
  3. Enable it on the query call and read the index utilisation header, then test the recommended paths.

Exam tip: Tuning an indexing policy for one query: enable index metrics and read the utilised and potential indexes.

AI-200 Azure Cosmos DB for NoSQL: SDK Queries, RUs, Vector Search and Change Feed — the lesson that teaches this.

Question 4Develop AI solutions by using Azure data management services

A Cosmos DB for NoSQL container stores chat turns with a large content string, a token-usage object and several metadata fields. Every query filters on /userId and /sessionId and sorts by /createdAt. The container uses the default indexing policy, and write RU charges are the largest part of the bill. The team must lower write RU without slowing these queries. What should the developer change?

Choose one.

  • a
    Add a composite index on /userId, /sessionId and /createdAt to the default policy

    A composite index can speed up the filtered, sorted query, but it adds index entries on each write and leaves every other path indexed, so write RU rises rather than falls.

  • b
    Set the account default consistency level to Eventual to make writes cheaper

    Write RU cost is the same at every consistency level; consistency changes read cost and guarantees, not index maintenance.

  • c
    Include /userId/?, /sessionId/? and /createdAt/? and exclude the root /* path Correct

    Indexing only the three queried paths keeps those queries efficient while every other property stops costing index maintenance on each write.

  • d
    Exclude /userId/?, /sessionId/? and /createdAt/? and keep the root /* path

    This is the reverse of what is needed: it removes the paths the queries rely on and keeps indexing the large unqueried content.

The concept

By default every property is indexed, and each indexed property adds to the RU cost of every write.

Why that’s the answer

The default policy includes /* so every path, including long text and nested objects, is indexed on each write. When the query patterns are known, include only the queried paths and exclude /* to cut write RU while keeping those queries indexed. Adding a composite index to the default policy adds index work on each write instead of removing it, consistency does not change write cost, and excluding the queried paths reverses the fix.

How to reason it out
  1. List the paths the queries filter and sort on.
  2. Recognise that the default policy indexes every other path too, which raises write RU.
  3. Include the queried paths and exclude the rest of the document.

Exam tip: Known query patterns: include only the paths you filter or sort on and exclude /* to cut write RU.

AI-200 Azure Cosmos DB for NoSQL: SDK Queries, RUs, Vector Search and Change Feed — the lesson that teaches this.

Question 5Develop AI solutions by using Azure data management services

A container stores document chunks with a 1,536-dimension float32 embedding at /embedding. Vector search works, but each insert costs several times more RU than the team expected. The indexing policy is:{ "indexingMode": "consistent", "includedPaths": [{ "path": "/*" }], "excludedPaths": [{ "path": "/\"_etag\"/?" }], "vectorIndexes": [{ "path": "/embedding", "type": "diskANN" }] }Which change lowers insert RU without making vector queries more expensive?

Choose one.

  • a
    Remove the vectorIndexes entry and rely on VectorDistance over the range index

    Without a vector index, VectorDistance falls back to scanning vectors, which raises query RU and latency. The range indexing of the array would also remain.

  • b
    Change the vector index type from diskANN to quantizedFlat for /embedding

    Switching vector index types does not stop the /* range index from indexing each of the 1,536 array elements, which is what inflates insert cost.

  • c
    Add /embedding/* to excludedPaths and keep the diskANN vector index Correct

    The vector index is separate from the range index. Excluding the embedding path from range indexing removes the per-element index work while the diskANN index still serves vector queries.

  • d
    Change the embedding dataType from float32 to float16 in the vector policy

    float16 halves vector storage, but the /* range index would still index every array element on each insert, and vector policy settings cannot simply be edited in place.

The concept

Vector indexes are defined separately from range indexing; the embedding path should be excluded from range indexing so writes don't index every array element.

Why that’s the answer

With includedPaths /* the range index treats the embedding as an array and indexes every element, so each insert pays for 1,536 extra index entries. Microsoft's sample policies add the vector path (for example /embedding/*) to excludedPaths alongside the vectorIndexes entry. The diskANN index still serves VectorDistance queries. Changing the vector index type or data type leaves the range indexing in place, and removing the vector index makes queries expensive.

How to reason it out
  1. Notice that /* includes every path, including the embedding array.
  2. Separate the two index structures: the range index (includedPaths) and the vector index (vectorIndexes).
  3. Exclude the vector path from range indexing and keep the vector index for queries.

Exam tip: Always exclude the embedding path from includedPaths range indexing; the vector index is configured separately.

AI-200 Azure Cosmos DB for NoSQL: SDK Queries, RUs, Vector Search and Change Feed — the lesson that teaches this.

Question 6Develop AI solutions by using Azure data management services

An agent-memory API runs this query against Cosmos DB for NoSQL and receives an error saying the ORDER BY needs a corresponding composite index:SELECT * FROM c WHERE c.userId = @u ORDER BY c.pinned DESC, c.updatedAt DESCWhich entry should the developer add to compositeIndexes?

Choose one.

  • a
    [{"path": "/pinned", "order": "descending"}, {"path": "/updatedAt", "order": "ascending"}]

    Mixing descending and ascending neither matches the query's directions nor is their exact reverse, so the query still has no usable composite index.

  • b
    [{"path": "/updatedAt", "order": "descending"}, {"path": "/pinned", "order": "descending"}]

    The directions match, but the path sequence is reversed relative to the ORDER BY clause, and composite index path order matters.

  • c
    [{"path": "/updatedAt", "order": "ascending"}, {"path": "/pinned", "order": "ascending"}]

    Both the path sequence and the directions differ from the query, so this composite index cannot serve the sort.

  • d
    [{"path": "/pinned", "order": "descending"}, {"path": "/updatedAt", "order": "descending"}] Correct

    The paths are in the same sequence as the ORDER BY clause with matching directions, so the composite index can serve the sort.

The concept

An ORDER BY on two or more properties needs a composite index whose path order and directions match the clause (or are its exact reverse).

Why that’s the answer

Range indexes from /* can sort on one property, but a multi-property ORDER BY requires a composite index. The index must list the paths in the same order as the ORDER BY, and its directions must match the query or all be reversed. Only the keyed definition matches both the sequence (pinned, then updatedAt) and the directions (descending, descending).

How to reason it out
  1. Read the ORDER BY clause: pinned DESC, then updatedAt DESC.
  2. Keep the path sequence identical in the composite index.
  3. Match the directions, or reverse every one of them.

Exam tip: Composite index for ORDER BY: same path order, and same directions or all of them reversed.

AI-200 Azure Cosmos DB for NoSQL: SDK Queries, RUs, Vector Search and Change Feed — the lesson that teaches this.

What AI-200 domain 2 tests, topic by topic

The official exam guide breaks Develop AI solutions by using Azure data management services into 4 topics. The question bank follows the same split, so a weak topic shows up as a cluster of misses you can go back and read.

Published AI-200 practice questions per topic in Develop AI solutions by using Azure data management services
TopicWhat it coversQuestions
Develop AI solutions by using Azure Cosmos DB for NoSQLSkills outline section (AI-200, study guide dated April 15, 2026). Connect to Azure Cosmos DB for NoSQL by using the SDK and run queries; Optimize query performance and Request Units (RUs) consumption by using indexing policies and consistency levels; Store and retrieve embeddings and execute vector similarity search for semantic retrieval; Implement a change feed processor to detect and handle new or updated items.28
PostgreSQL connections, schemas and data typesSkills outline section (AI-200, study guide dated April 15, 2026), Develop AI solutions by using Azure Database for PostgreSQL (first part). Connect and query Azure Database for PostgreSQL by using SDKs; Model schemas and implement indexing strategies, including designing tables and choosing appropriate data types; Implement connection optimization to improve throughput and minimize latency.28
PostgreSQL pgvector indexing, compute and vector searchSkills outline section (AI-200, study guide dated April 15, 2026), Develop AI solutions by using Azure Database for PostgreSQL (second part). Implement indexing strategies, including optimizing query latency and reducing pgvector compute overhead; Configure compute, memory, and storage resources to support vector workloads; Run vector similarity search, including storing embeddings, semantic retrieval, and implementing retrieval-augmented generation (RAG) patterns by using metadata filter.28
Integrate Azure Managed Redis in AI solutionsSkills outline section (AI-200, study guide dated April 15, 2026). Implement Azure Managed Redis data operations, including caching, expiration, and invalidation; Implement vector indexing to enable similarity search.28
Total112

Revise Develop AI solutions by using Azure data management services before you drill it

Other AI-200 domains

Develop AI solutions by using Azure data management services: your questions

Develop AI solutions by using Azure data management services is domain 2 of the AI-200 exam guide and carries 28% of the scored content — the heaviest of the 4 domains. On a 50-question paper that works out to roughly 14 questions, though Microsoft Azure does not publish an exact per-domain count and individual exam forms vary.

Source

The domain weight and topic list on this page come from the official AI-200 exam guide.