Microsoft certification · Exam DP-800

DP-800 Mock Exam Page 3

Developing AI-Enabled Database Solutions

Free DP-800 mock exam questions 21–26, each with the answer and an explanation.

20 questions · 34 minutes · free, no sign-up

Free DP-800 questions

21–26 of 26 free
Question 21 Choose 2
You have an Azure SQL database named AdventureWorksDB that contains a table named dbo.Employee.
You have a C# Azure Functions app that uses an HTTP-triggered function with an Azure SQL input binding to query dbo.Employee.
You are adding a second function that will react to row changes in dbo.Employee and write structured logs.
You need to configure AdventureWorksDB and the app to meet the following requirements:
• Changes to dbo.Employee must trigger the new function within five seconds.
• Each invocation must processes no more than 100 changes.
Which two database configurations should you perform? Each correct answer presents part of the solution. NOTE: Each correct selection is worth one point.
Show answerHide answer

Correct answer: C, D Enable change tracking on the dbo. Employee table.Enable change tracking at the database level.

Explanation

Explanation:

This question tests the database prerequisites for an Azure SQL trigger in Azure Functions. The trigger detects INSERT, UPDATE, and DELETE changes by using SQL Server change tracking. Change tracking must be enabled first at the database level and then on the specific monitored table.

✔️ Correct Option:

✔️ C — Enable change tracking on the dbo.Employee table.
The Azure SQL trigger monitors changes to a specific table through SQL change tracking. Enabling change tracking on dbo.Employee allows the trigger to identify inserted, updated, and deleted rows and pass those changes to the function. This is mandatory for the new function to react to row changes in the table.

✔️ D — Enable change tracking at the database level.
Change tracking must be enabled for AdventureWorksDB before it can be enabled for dbo.Employee. The database-level setting maintains the change-tracking infrastructure and retention policy, while the table-level setting specifies the table monitored by the Azure SQL trigger. Both settings are required database configurations.

❌ Incorrect Options:

❌ A — Create an AFTER trigger on dbo.Employee for DML.
A traditional DML trigger runs inside the database when a change occurs, but it is not the mechanism used by the Azure Functions SQL trigger. The Azure SQL trigger specifically relies on SQL change tracking, not an AFTER INSERT, UPDATE, or DELETE trigger.

❌ B — Set Sql_Trigger_MaxBatchSize to 100.
This controls the maximum number of changes sent to the function in one trigger iteration, but it is an Azure Functions application/host configuration setting, not a database configuration. Also, 100 is already the default value, so it is not one of the required database changes.

❌ E — Set Sql_Trigger_PollingIntervalMs to 5000.
This setting controls the delay between polling cycles and is configured in the Azure Functions app, not in the SQL database. A value of 5,000 ms would mean up to a five-second delay between polls, but it is not a database configuration and is unnecessary because the default polling interval is already 1,000 ms.

❌ F — Enable change data capture (CDC) for dbo.Employee table changes.
Change Data Capture captures detailed row changes for consumption, but the Azure SQL trigger for Functions is documented as using SQL change tracking, not CDC. Enabling CDC does not satisfy the required change-tracking configuration for this trigger.

🔧 Reference:
→ Azure SQL trigger for Functions — Microsoft Learn — Confirms that the trigger uses SQL change tracking and requires it at both database and table level.

→ Manipulate data in Azure SQL Database with Azure Functions — Microsoft Learn — Shows the required ALTER DATABASE ... SET CHANGE_TRACKING = ON and ALTER TABLE ... ENABLE CHANGE_TRACKING steps.
Question 22
You have an Azure SQL database that contains the following tables and columns.

Embeddings in the NotesEnbeddings and DescriptionEabeddings tables have been generated from values in the Description and notes columns of the Articles table by using different chunk sizes. You need to perform approximate nearest neighbor (ANN) queries across both embedding tables. The solution must minimize the impact of using different chunk sizes. What should you use? To answer, select the appropriate options in the answer area. NOTE: Each correct selection is worth one point.

Show answerHide answer

Explanation



Explanation:

This question evaluates the implementation of approximate nearest neighbor (ANN) queries across multiple embedding tables that use different chunking strategies. The goal is to minimize the impact of varying chunk sizes by selecting the appropriate vector search function and distance metric that align with how embeddings are typically generated and compared.

✔️ Correct Option:

VECTOR_SEARCH:
This function is designed specifically for approximate nearest neighbor searches using vector indexes. It allows you to query a vector column and retrieve the most similar vectors efficiently, which is essential when performing ANN queries across tables like NotesEmbeddings and DescriptionEmbeddings . Using VECTOR_SEARCH ensures the query leverages the vector index rather than performing a full scan.

cosine distance:
Cosine distance measures the angle between vectors, ignoring their magnitude. This is particularly effective when comparing embeddings generated from different chunk sizes, as it focuses on the semantic direction of the vectors rather than their length. Most embedding models are optimized for cosine similarity, making cosine distance the standard metric for such comparisons .

❌ Incorrect Options:

VECTOR_DISTANCE:
This function calculates the exact distance between vectors and is used for precise nearest neighbor searches. It requires scanning every row in the table, which is inefficient for large datasets and does not leverage the ANN index that VECTOR_SEARCH utilizes .

Vector_NORM:
This is not a valid vector search function in Azure SQL Database. It likely refers to a mathematical norm operation, which is unrelated to retrieving nearest neighbors from embedding tables.

dot product:
While dot product can be used as a similarity measure, it is sensitive to vector magnitude. Different chunk sizes can produce embeddings of varying magnitudes, making dot product less reliable for comparing them compared to cosine distance .

Euclidean distance:
This metric considers both direction and magnitude. Because different chunk sizes may result in embeddings with different magnitudes, Euclidean distance can be skewed by these size differences. Cosine distance is generally preferred for comparing embeddings from varied chunking strategies .

🔧 Reference:
→ VECTOR_SEARCH (Transact-SQL) - Confirms VECTOR_SEARCH is used for approximate nearest neighbor searches with vector indexes.

→ Prepare SQL for vector search - Explains that cosine distance is commonly used for embedding comparisons as it focuses on direction rather than magnitude.
Question 23 Choose 1
You have a SQL database in Microsoft Fabric that contains a table named dbo.Orders, dbo.Orders has a clustered index, contains three years of data, and is partitioned by a column named OrderDate by month.
You need to remove all the rows for the oldest month. The solution must minimize the impact on other queries that access the data in dbo.orders.
Solution: Run the following Transact-SQL statement.
DELETE FROM dbo.Orders
WHERE OrderDate < DATEADD(nonth, -36, SYSUTCDATETIME());
Does this meet the goal?
Show answerHide answer

Correct answer: B No

Explanation

Explanation

This question tests how to remove one month of data from a large partitioned table with the least impact on other queries. A DELETE with a WHERE clause removes rows one at a time, logs every row, and holds locks for the whole operation. On a table with three years of data, this creates heavy log activity and blocking. A partition level operation is the better approach because it affects only the target partition.

✅ B. No
The solution does not meet the goal. A DELETE statement removes rows individually and writes a log entry for each one, which uses large amounts of transaction log space and holds locks that can block other queries on dbo.Orders. It also ignores the monthly partitioning. TRUNCATE TABLE with WITH (PARTITIONS (1)) removes the oldest month with far less logging and locking.

❌ A. Yes
Choosing Yes assumes that a filtered DELETE is an efficient way to clear the oldest month. It is not, because it scans and removes each row, generates heavy transaction logging, and can escalate locks, which slows or blocks other queries reading the table. The table is partitioned by month, so a partition level truncate is the correct way to minimize the impact.

🔧 Reference
🔗 TRUNCATE TABLE (Transact-SQL) – Microsoft Learn → confirms that TRUNCATE TABLE can remove all rows from specified partitions using WITH PARTITIONS, and uses fewer log and system resources than DELETE, which logs every row it removes.
Question 24 Choose 1
You have an SDK-style SQL database project stored in a Git repository. The project targets an Azure SQL database.
The CI build fails with unresolved reference errors when the project ieferences system objects.
You need to update the SQL database project to ensure that dotnet build validates successfully by including the correct system objects in the database model for Azure SQL Database.
Solution: Add the Microsoft.SqlServer.Dacpacs.Mastet NuGet package to the project. Does this meet the goal?
Show answerHide answer

Correct answer: B No

Explanation

Explanation:

This question examines how to resolve validation errors caused by system object references in SQL database projects that target Azure SQL Database. The build process performs reference validation, and by default, the project model does not include system objects, which leads to errors when the project references them. The solution must add the correct master.dacpac for the target platform, but the specified package name must match Azure SQL Database, not SQL Server.

✔️ Correct Option:

The proposed solution adds the Microsoft.SqlServer.Dacpacs.Master NuGet package. This package contains the system object model for SQL Server, not Azure SQL Database. When the project targets Azure SQL Database, the correct package is Microsoft.SqlServer.Dacpacs.Azure.Master . Therefore, using the SQL Server version cannot correctly include the Azure SQL Database system objects, and the build still fails to validate successfully.

❌ Incorrect Options:

A. Yes:
This is incorrect. Although adding a master package is the correct direction, the package specified in the question is the SQL Server version rather than the Azure SQL Database version. The platform mismatch prevents the reference errors from being fully resolved.

🔧 Reference:
→ SQL projects system objects - Confirms that for Azure SQL Database, you must use Microsoft.SqlServer.Dacpacs.Azure.Master to include the correct system object model.
Question 25
Your company has an ecommerce catalog in a Microsoft SQL Server 202b database named SalesDB SalesDB contains a table named products, products contains the following columns:

• product.id (int)
• product_name (nvarchar(200))
• description (nvarchar(max))
• category (nvarchar(50))
• brand (nvarchar(W))
• price (decimal)
• sku (nvarchar(40))

The description fields ate updated dairy by a content pipeline, and price can change multiple times per day. You want customers to be able to submit natural language queries and apply structured filters for brand and price. You plan to store embeddings in a new VECTOR(1536) column and use VECTOR_SEARCH(... METRIC=’ cosine' ...).
For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.

Show answerHide answer

Explanation



Explanation:

This question assesses the design considerations for implementing vector search in SQL Server 2025. It covers the composition of text for generating embeddings, the separation of semantic search from structured filtering, and the underlying data type of the vector column.

✅ Correct Option:

Statement 1 (Yes):
Concatenating product_name, category, and description provides a rich semantic context that captures the product's key attributes and meaning. This supports natural language queries where customers search by intent or product features, making it a sound strategy for building the embedding text.

Statement 3 (Yes):
The VECTOR(1536) column stores embeddings as single-precision floating-point numbers. SQL Server's vector data type internally uses float(32) for each dimension to represent the array of numeric values, confirming that the underlying base type is float(32).

❌ Incorrect Options:

Statement 2 (No):
Including price in the embedding text is not required because price is a structured numeric field that changes frequently. Since the scenario explicitly requires applying structured filters for price, it is handled through standard T-SQL WHERE clauses. Including price in the semantic embedding would add noise and require regeneration whenever the price changes, which is inefficient.

🔧 Reference:
→ Vector search in the SQL Server EF Core Provider - Confirms the vector data type is used to store embeddings as arrays of numbers for similarity search.

→ CREATE VECTOR INDEX (Transact-SQL) - Demonstrates using traditional indexes for filtering on columns like category while using vector search for semantic matching.
Question 26
You need to create a solution that meets the development requirements for retrieving the patient lists.

How should you complete the Transact-SQL code? To answer, select the appropriate options in the answer area.

NOTE: Each correct selection is worth one point.
Show answerHide answer

Explanation


Explanation:

This question evaluates Transact-SQL subquery structures and correlated existence checks within stored procedures in an Azure SQL environment. Specifically, it tests how to retrieve master records based on conditional activity occurring within a related transactional table over a specific rolling time window. Developers must properly connect the outer table to the inner subquery using a correlation predicate. Choosing the right existence operator ensures high performance and accurate row filtering without duplicates. Ultimately, this pattern allows systems to efficiently query active entities based on recent transaction logs.

Correct Option:

✅ WHERE EXISTS
The EXISTS operator in Transact-SQL is a boolean operator that evaluates to true if the subquery returns any rows. In this stored procedure, WHERE EXISTS is the optimal choice for evaluating whether a patient has engaged in any medical procedures within the specified thirty-day timeframe. Unlike IN or NOT IN, EXISTS optimizes performance by processing efficiently with correlated subqueries and halting further evaluation within the inner query as soon as the first matching row is found for each outer row. This makes it highly scalable for large healthcare datasets where patient activity must be verified against transaction logs without incurring unnecessary computational overhead or handling multi-valued list expansions incorrectly.

✅ WHERE p.PatientId = pr.PatientId
Correlating the outer table dbo.Patients (p) with the inner subquery table dbo.Procedures (pr) requires an explicit equality predicate linking their corresponding identifiers. Using WHERE p.PatientId = pr.PatientId establishes a valid correlation between the main patient entity and their respective procedure records. This ensures that the subquery evaluates procedure transactions specifically for the individual patient currently being processed by the outer query rather than evaluating global records across all patients. Combined with the transaction date filter, this proper key linkage guarantees that active patients are accurately identified according to their specific procedure history within the last thirty days.

Incorrect options:

❌ WHERE NOT EXISTS
WHERE NOT EXISTS filters for patients who have no matching records in the procedures table during the timeframe, which retrieves inactive or non-participating patients instead of active ones.

❌ WHERE p.PatientId IN
WHERE p.PatientId IN expects a static or evaluated list of values rather than a correlated existence check, and can suffer from performance degradation and memory overhead with large datasets.

❌ WHERE p.PatientId NOT IN
WHERE p.PatientId NOT IN checks for the absence of patient IDs in a subquery and is vulnerable to NULL propagation issues that can cause the entire query to return zero rows.

❌ HAVING p.PatientId = pr.PatientId
HAVING clauses are used exclusively with GROUP BY aggregations to filter grouped summary rows, making it syntactically invalid here since no aggregation or group clause is present.

❌ HAVING p.TransactionId = pr.TransactionId
This option is syntactically invalid because HAVING requires an aggregation context and grouping, and it references a transaction ID instead of properly correlating patient identifiers.

❌ WHERE p.TransactionId = pr.TransactionId
Correlating on TransactionId instead of PatientId fails to link patient master records to their respective procedure records, resulting in incorrect logic and query failure.

Reference:
→ EXISTS (Transact-SQL) - Microsoft Learn: Confirms that the EXISTS operator tests for the existence of rows in a subquery.

→ SELECT (Transact-SQL) - Microsoft Learn: Confirms proper subquery syntax and correlation predicates in Transact-SQL.

That's the last free question

You've seen the free 30% (26 of 87 questions). Full access unlocks every question and full-length DP-800 mock exams (60 questions, 100 minutes), a different mock on every attempt.

Unlock full mock exam
Full mock exam

Sit the DP-800 exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real DP-800 exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full DP-800 mock exam
  • 60questions per mock
  • 100 mintime limit
  • 87questions in the bank
  • Newmock on every attempt