Q01 - Question
You design a products table for filtered vector search in Azure Database for PostgreSQL. Most queries filter by category_id and a price range before they order by vector similarity. Products also have vendor-specific attributes that differ between products and are rarely filtered. Which two design choices should you make? Each correct answer presents part of the solution. Select two.
Domain: Develop AI solutions by using Azure data management services (25–30%) Type: Multi-select
- A. Store price in a JSONB column and create a GIN index to accelerate BETWEEN range filters.
- B. Store category_id and price as structured columns and create a composite B-tree index on (category_id, price).
- C. Partition the two-million-row table by price range to speed up the category filters.
- D. Store the vendor-specific, rarely filtered attributes in a JSONB column.
B and D are correct.
Explanation: Structured columns with a B-tree index on (category_id, price) let PostgreSQL narrow the candidate rows before it calculates vector distances. A JSONB column gives you schema flexibility for dynamic attributes that you rarely filter on. This combination optimizes the common case and keeps the design flexible.
A is incorrect: GIN indexes support containment queries but not range queries. A price range filter on JSONB requires an expression index or a sequential scan.
C is incorrect: Consider partitioning when tables exceed tens of millions of rows and queries filter by the partition key. Here, the queries filter mainly by category, so partitioning by price adds complexity and doesn't match the query pattern.
Q02 - Question
An Azure Functions Cosmos DB trigger regenerates embeddings for every changed document in a knowledge base container. Most document changes update only the status, category, or access permission fields. Embedding API costs and rate limit errors are increasing. You need to reduce embedding API calls and keep embeddings accurate for content changes. What should you do?
Domain: Develop AI solutions by using Azure data management services (25–30%) Type: Single choice
- A. Replace the trigger with a scheduled job that regenerates embeddings for all documents in the container.
- B. Use the pull model and read the change feed from the beginning on each run without storing a continuation token.
- C. Store a hash of the content used to generate the embedding, regenerate the embedding only when the hash changes, and update the hash in the same operation.
- D. Increase the lease container throughput above 400 RU/s.
C is correct.
Explanation: Metadata-only changes don't need new embeddings. A content hash lets you detect changes to the fields that affect the embedding without retrieving previous versions. Update the hash when you regenerate the embedding so that future comparisons work correctly.
A is incorrect: Regenerating embeddings for all documents increases embedding API calls, and a scheduled job replaces event-driven processing with periodic scans.
B is incorrect: Without a stored continuation token, each run reprocesses changes that were already handled, which increases embedding API calls.
D is incorrect: The lease container stores leases and checkpoints and has minimal throughput requirements. More lease throughput doesn't reduce the number of embedding API calls.
Q03 - Question
You configure a Redis Stream as a high-volume queue for AI inference requests. Workers acknowledge each task with XACK after processing. Monitoring shows that Redis memory use continues to grow even though the number of pending tasks stays low. You need to limit memory growth. What should you do?
Domain: Develop AI solutions by using Azure data management services (25–30%) Type: Single choice
- A. Add maxlen with approximate trimming to XADD, or call XTRIM periodically after you acknowledge tasks.
- B. Call XACK a second time for each task so that Redis deletes it from the Stream.
- C. Use XINFO commands so that Redis expires completed tasks automatically.
- D. Use XCLAIM on completed tasks so that Redis releases their memory.
A is correct.
Explanation: Stream tasks stay in memory until you remove them explicitly. Completed tasks don't expire automatically. Use maxlen with approximate=True on XADD, or call XTRIM periodically, to keep only the most recent tasks. Plan this cleanup strategy before you deploy a high-volume queue.
B is incorrect: XACK marks a task complete for the consumer group. Acknowledged tasks stay in the Stream until you trim them.
C is incorrect: XINFO commands return metrics such as total tasks, pending tasks, and consumers. They don't remove or expire tasks.
D is incorrect: XCLAIM reassigns pending tasks to another consumer. It doesn't remove tasks from the Stream.
Q04 - Question
You deploy a Python AI application that reads and writes items in Azure Cosmos DB for NoSQL. Security policy prohibits shared secrets in production and requires identity-based access control. You want one code path for local development and the deployed environment. Which two actions should you take? Each correct answer presents part of the solution.
Domain: Develop AI solutions by using Azure data management services (25–30%) Type: Multiple choice
- A. Create the CosmosClient with a DefaultAzureCredential from the Azure Identity library.
- B. Store the primary account key in application settings and rotate to the secondary key as needed.
- C. Create a new CosmosClient instance for each incoming request.
- D. Assign the Cosmos DB Built-in Data Contributor role to the application's managed identity.
A and D are correct.
Explanation: Microsoft Entra ID authentication uses role-based access control instead of shared secrets. DefaultAzureCredential uses your Azure CLI or Visual Studio credentials during local development and uses managed identity in deployed environments, so the same code runs in both. Before you use Entra ID authentication, assign an RBAC role to the identity. Cosmos DB Built-in Data Contributor grants read/write operations.
B is incorrect: Account keys are shared secrets that grant full access to all resources in the account. Keys do not integrate with centralized identity management or conditional access policies.
C is incorrect: Creating a client per request discards connection pools and cached routing information. This adds latency and might exhaust available connections. Create the client once at application startup and reuse it.
Q05 - Question
A nightly Python job uses psycopg to load about 50,000 archived agent messages into the messages table in Azure Database for PostgreSQL. The job currently runs one INSERT statement per row in a loop and takes too long. You need the highest load throughput. What should you do?
Domain: Develop AI solutions by using Azure data management services (25–30%) Type: Single choice
- A. Use executemany to send the rows as parameterized INSERT statements.
- B. Use cur.copy() with a COPY messages (conversation_id, role, content) FROM STDIN statement and write each row with copy.write_row().
- C. Build one multi-row INSERT statement by concatenating the message values into the SQL string.
- D. Keep the per-row INSERT loop and open a new connection for each row so that connections stay short-lived.
B is correct.
Explanation: For larger datasets of 10,000 rows or more, the COPY command provides the highest performance. It is often two to 10 times faster than individual inserts. In psycopg, use cur.copy() and write each record with copy.write_row().
A is incorrect: Use executemany for inserting hundreds to a few thousand rows. For 50,000 rows, COPY provides higher throughput.
C is incorrect: Never use string formatting or concatenation to build queries with data values. Use parameterized queries to prevent SQL injection.
D is incorrect: Creating new database connections is expensive because each requires network handshakes, authentication, and server-side resource allocation. A new connection per row makes the load slower.
Q06 - Question
You store 1536-dimensional dense embeddings from text-embedding-ada-002 in a vector(1536) column in Azure Database for PostgreSQL. Storage costs are increasing as the document table grows. You must reduce embedding storage and keep acceptable similarity search quality. What should you do?
Domain: Develop AI solutions by using Azure data management services (25–30%) Type: Single choice
- A. Change the column to sparsevec(1536) so that only nonzero values are stored.
- B. Change the column to vector(768) and keep the same embedding model.
- C. Change the column to halfvec(1536) after benchmarking confirms that search quality is acceptable.
- D. Create an IVFFlat index on the column to compress the stored vectors.
C is correct.
Explanation: The halfvec type stores elements as 16-bit floating-point numbers and uses half the storage of the vector type. Use halfvec only after you benchmark and verify that half precision provides acceptable search quality for your use case.
A is incorrect: The sparsevec type is for models that produce sparse embeddings where most elements are zero. Dense embeddings from text-embedding-ada-002 are not sparse.
B is incorrect: The vector(n) dimension must match the output dimension of the embedding model. A 768-dimension column causes insertion errors for 1536-dimension embeddings.
D is incorrect: An index does not reduce the size of the vector column. An IVFFlat index adds about 1 to 1.5 times the vector column size in storage.
Q07 - Question
You design vector storage for a product catalog in Azure Managed Redis. Each product has nested specifications, several variant records, and two embeddings: one for the description and one for the main image. The application already exchanges product data in JSON format. Which storage approach should you use?
Domain: Develop AI solutions by using Azure data management services (25–30%) Type: Single choice
- A. Store each product as a Redis JSON document with embeddings converted by tolist(), and create the index with IndexType.JSON and JSONPath field names such as $.embedding.
- B. Store each product as a Redis Hash with both embeddings converted by tobytes(), and create the index with IndexType.HASH.
- C. Store each product as a Redis Hash, and serialize the nested specifications and variants into a single text field.
- D. Store each product as a Redis JSON document with embeddings converted by tobytes(), and create the index with IndexType.HASH.
A is correct.
Explanation: Choose Redis JSON when your data has nested structures, you need multiple vectors per item, or your application already uses JSON. Convert each embedding to a numeric array with tolist(), and define the index with IndexType.JSON, $. JSONPath field names, and the as_name parameter for query references.
B is incorrect: Redis Hash stores flat field-value pairs only. It's the better choice for simple records when you need maximum memory efficiency and query speed, but it doesn't support nested objects.
C is incorrect: Flattening nested data into one text field works against the documented guidance. Hash is intended for data models that won't need nested objects.
D is incorrect: JSON documents store vectors as numeric arrays, not binary bytes, and a JSON-based index must use IndexType.JSON.
Q08 - Question
You are designing a new Azure Cosmos DB for NoSQL container for a legal research application. The embedding model produces 384-dimension vectors. At launch, each physical partition will store about 600 vectors. The business requires similarity search results with guaranteed accuracy, and approximate results aren't acceptable. Which vector index configuration should you use at launch?
Domain: Develop AI solutions by using Azure data management services (25–30%) Type: Single choice
- A. A diskANN index, because it provides the lowest latency and RU cost.
- B. A quantizedFlat index, because it supports up to 4,096 dimensions.
- C. Set indexingMode to none and retrieve embeddings by point reads.
- D. A flat index on the embedding path.
D is correct.
Explanation: A flat index performs brute-force k-nearest neighbor search and compares the query vector against every indexed vector, so it provides 100% accuracy. The 384-dimension vectors are within the flat index limit of 505 dimensions, and the small dataset limits the latency and RU cost of brute-force comparison.
A is incorrect: DiskANN uses approximate nearest neighbor algorithms, which doesn't meet the guaranteed accuracy requirement. It also requires at least 1,000 vectors before the index becomes effective, and with fewer vectors queries fall back to brute-force scans.
B is incorrect: QuantizedFlat compresses vectors and can cause minor differences in ranked results. It also requires at least 1,000 vectors before the index becomes effective.
C is incorrect: The none mode disables indexing and supports only point reads by item ID and partition key. It doesn't support similarity search across embeddings.
Q09 - Question
You add read replicas to an Azure Database for PostgreSQL server that supports a product recommendation engine. The application runs vector similarity searches for recommendations. It also shows users their preferences immediately after they update them. How should you route these queries?
Domain: Develop AI solutions by using Azure data management services (25–30%) Type: Single choice
- A. Route all vector similarity searches to the primary server to avoid replica lag.
- B. Route preference updates to a read replica and route preference reads to the primary server.
- C. Create 10 read replicas and use DNS-based routing to distribute all queries evenly.
- D. Route vector similarity searches to read replicas and route queries for just-updated preferences to the primary server.
D is correct.
Explanation: Replication to read replicas is asynchronous, so replicas might be slightly behind the primary. Vector similarity searches are read-only and can tolerate slight staleness, so you can route them to replicas. Queries that need immediate consistency, such as a user's just-updated preferences, should go to the primary server.
A is incorrect: Recommendation searches can tolerate a few seconds of replica lag. If you send all of them to the primary server, you lose the extra query capacity that the replicas provide.
B is incorrect: Read replicas handle read queries only. Only the primary server can process the preference updates.
C is incorrect: You can create up to five read replicas per primary server. Even distribution also sends queries that need immediate consistency to replicas.
Q10 - Question
You plan to create an Azure Managed Redis resource with the Azure CLI. You then plan to build and run a Python Flask web app that connects with Microsoft Entra ID and publishes and subscribes to Redis channels and patterns. Which two items must you have in your development environment? Each correct answer presents part of the solution.
Domain: Develop AI solutions by using Azure data management services (25–30%) Type: Multiple choice
- A. Python 3.12 or greater
- B. Python 3.8 or greater
- C. The Azure CLI redisenterprise extension
- D. A Redis Streams consumer group created before the app starts
A and C are correct.
Explanation: The app requires Python 3.12 or greater. To create the Azure Managed Redis resource with the Azure CLI, install the latest Azure CLI and the redisenterprise extension by running az extension add --name redisenterprise.
B is incorrect: Python 3.8 doesn't meet the requirement. The app requires Python 3.12 or greater.
D is incorrect: The app uses pub/sub channels and pattern subscriptions. Pub/sub doesn't use Streams consumer groups.