All Microsoft exams
Free DP-800 practice test: 30 questions with answers
30 original questions for Developing AI-Enabled Database Solutions, drawn from every topic area. Answer each one to see whether you got it right and why. No sign-up.
- Free questions
- 30
- Full bank
- 100 questions
All 30 DP-800 questions with answers
The same questions as the test above, grouped by exam topic. Open any question to see the answer and explanation.
Secure, optimize, and deploy database solutions (10 questions)
Question 1
A column holds national identification numbers that must stay encrypted in the database, even from administrators, and the application needs equality searches on them. Which feature fits best?
- ATransparent Data Encryption of data files
- BDynamic Data Masking on result columns
- CKeeping the numbers as plain text in a view
- DAlways Encrypted with deterministic encryption
Show answer and explanationHide answer
Correct answer: DAlways Encrypted keeps data encrypted from the client to storage, and deterministic encryption allows equality comparisons. Dynamic Data Masking only obscures output, TDE protects files, and plain text with a view exposes the data.
Question 2
Support staff must see only the last four digits of a credit card number, while the full value stays stored. Which feature should be used?
- ARow-Level Security on the card table
- BAlways Encrypted with randomized encryption
- CA CHECK constraint on the card number
- DDynamic Data Masking
Show answer and explanationHide answer
Correct answer: DDynamic Data Masking obscures returned values for users without the unmask permission while leaving the stored data unchanged. Encryption, CHECK constraints, and row filtering solve different problems.
Question 3
Sales staff should see only the orders for their own region, enforced inside the database for every query. Which feature provides this?
- ARow-Level Security with a security predicate
- BA separate database per user with its own schema
- CAsking users to append a WHERE clause
- DA view that users can edit, with their own write grants
Show answer and explanationHide answer
Correct answer: ARow-Level Security applies a predicate function to filter rows for each user automatically, regardless of the query. Editable views, per-user databases, and client-side filters can be bypassed or do not scale.
Question 4
A developer must be able to read a table but not modify it. Which permission approach follows least privilege?
- AGrant db_owner to the developer's login
- BGrant SELECT on the table to the developer's role
- CShare the administrator login details
- DGrant ALTER ANY SCHEMA and CONTROL on the whole database
Show answer and explanationHide answer
Correct answer: BGranting only SELECT on the specific object applies least privilege. db_owner and ALTER grant far more, and sharing an administrator login removes accountability.
Question 5
An application connects to Azure SQL without storing a password in its configuration. Which approach is recommended?
- AUse a managed identity for the application
- BEmbed a shared key in the source code
- CConnect as the sa login
- DStore the administrator password in the app's public file
Show answer and explanationHide answer
Correct answer: AManaged identities provide Azure AD-based authentication without stored credentials. Stored passwords, embedded keys, and shared administrator logins are insecure.
Question 6
A security audit requires a record of who accessed sensitive tables and when. Which feature provides this?
- AA sequence generator per table
- BDynamic Data Masking on columns
- CSQL auditing to a log destination
- DA check constraint on the sensitive table
Show answer and explanationHide answer
Correct answer: CAuditing records access and changes to defined objects and sends the logs to a chosen destination for review. Masking hides values, constraints validate data, and sequences generate numbers.
Question 7
A query runs slowly in production but fast in a test database. Which tool helps compare the actual execution plan and find the cause?
- AA plain text editor without profiling tools
- BQuery Store and the actual execution plan
- CA printed copy of the table schema
- DA spreadsheet listing the code and queries
Show answer and explanationHide answer
Correct answer: BQuery Store tracks plan history and runtime statistics, and actual execution plans show where time is spent. Editors, spreadsheets, and printouts do not reveal execution behaviour.
Question 8
Two transactions are waiting on each other for locks, and the database engine ends one of them. What is this situation called?
- AA stale statistic
- BA replication lag
- CA deadlock
- DA backup failure
Show answer and explanationHide answer
Correct answer: CA deadlock is a circular wait among transactions, which the engine resolves by terminating one. Replication lag and stale statistics are different issues, and backup failures do not involve locks.
Question 9
Reports need consistent reads while writes continue, without blocking readers. Which isolation option is designed for this?
- ADirty reads via READ UNCOMMITTED for faster throughput
- BSerializable isolation with range locks on every query
- CNo transaction isolation applied to connections
- DSnapshot isolation or read committed snapshot
Show answer and explanationHide answer
Correct answer: DSnapshot-based isolation uses row versioning so readers do not block writers and see consistent data. Serializable locking reduces concurrency, dirty reads return uncommitted data, and no isolation risks inconsistency.
Question 10
A table's indexes are fragmented after heavy updates, and query performance has dropped. Which maintenance action is typically appropriate?
- ARebuild or reorganize the affected indexes based on fragmentation level
- BDrop the statistics on the affected tables and leave them absent after heavy data changes
- CDisable the nonclustered indexes on the table and keep them disabled
- DDelete the table and recreate it from scratch every hour during business peak times
Show answer and explanationHide answer
Correct answer: ARebuilding or reorganizing fragmented indexes restores efficient page layout, with the choice depending on fragmentation. Dropping statistics, recreating tables hourly, and permanently disabling indexes all harm performance.
Design and develop database solutions (10 questions)
Question 11
A table stores orders, and queries mostly aggregate a few columns across millions of rows. Which index type best fits this workload?
- AA unique index on the order ID only
- BNo index, relying on table scans
- CA clustered columnstore index
- DA nonclustered index on every column
Show answer and explanationHide answer
Correct answer: CColumnstore indexes store data by column and compress it well, which speeds analytical aggregations over large tables. Per-column nonclustered indexes and unique IDs do not serve large aggregations, and scans without indexes are slow.
Question 12
A table must keep a full history of every change to each row, with the ability to query the state at a past time. Which table type should be used?
- AA table variable
- BSystem-versioned temporal table
- CA heap with no history
- DA view over the current table
Show answer and explanationHide answer
Correct answer: BSystem-versioned temporal tables keep history automatically in a history table and support point-in-time queries with FOR SYSTEM_TIME. A heap, a plain view, or a table variable does not preserve the history automatically.
Question 13
An application stores product attributes that vary by product type. The team wants to store the attributes in a column and index specific values for fast lookups. Which approach fits best?
- AA single text column with no structure
- BA JSON column with computed columns indexed on the frequently queried values
- COne table with hundreds of nullable columns
- DA file on disk referenced by path
Show answer and explanationHide answer
Correct answer: BA JSON column holds variable attributes, and indexing computed columns over the values queried often makes lookups fast. Unstructured text, very wide tables, and external files make querying harder.
Question 14
A column must always be unique among non-null values, and rows must not reference a missing parent row. Which constraints provide these guarantees?
- AUNIQUE and FOREIGN KEY
- BDEFAULT and CHECK only
- COnly a computed column
- DOnly an index with no constraint
Show answer and explanationHide answer
Correct answer: AUNIQUE enforces uniqueness and FOREIGN KEY enforces referential integrity against the parent table. DEFAULT supplies values, CHECK validates conditions, computed columns do not enforce either rule by themselves, and a plain index does not declare the constraint.
Question 15
A large sales table is queried mostly by month, and old months are archived. Which design helps manage the data efficiently?
- AKeep every month in one unpartitioned heap
- BDelete the table and recreate it each day
- CCopy the table each month into a new database with no indexes
- DPartition the table by month and switch out old partitions
Show answer and explanationHide answer
Correct answer: DPartitioning by month lets queries touch only relevant partitions, and partition switching moves old data out quickly. Unpartitioned heaps, copies with no indexes, and daily rebuilds are inefficient.
Question 16
A developer needs a reusable query that returns the active customers in a region and can be joined with other tables. Which object is most appropriate?
- AA check constraint
- BA trigger
- CA view
- DAn identity column
Show answer and explanationHide answer
Correct answer: CA view encapsulates a query as a named object that can be selected from and joined. Triggers run on data changes, identity columns generate numbers, and check constraints validate values.
Question 17
A calculation of a customer's tax based on rules must be reused in many queries. Which object should be created?
- AA trigger that runs on each read
- BA sequence
- CA clustered index
- DA scalar function
Show answer and explanationHide answer
Correct answer: DA scalar function returns a single value from inputs and can be reused in queries. Triggers respond to data modifications, sequences generate numbers, and indexes improve access paths.
Question 18
A stored procedure must insert an order and its lines together, and roll back everything if any part fails. Which T-SQL construct should be used?
- AA trigger on a read operation
- BTwo separate statements with no transaction
- CBEGIN TRANSACTION with TRY...CATCH and ROLLBACK on error
- DA view containing INSERT statements
Show answer and explanationHide answer
Correct answer: CAn explicit transaction with error handling commits all or nothing, which keeps the order and lines consistent. Separate statements can leave partial data, and views cannot run inserts or wrap them in transactions.
Question 19
A query must rank customers by total spend within each region and show the rank next to each row without collapsing the rows. Which feature should be used?
- AA scalar subquery per row with no ordering
- BA window function such as RANK() OVER (PARTITION BY region ORDER BY spend)
- CA DISTINCT on the customer name
- DGROUP BY region only
Show answer and explanationHide answer
Correct answer: BWindow functions compute ranks over partitions while keeping each row. GROUP BY collapses rows, DISTINCT removes duplicates, and unordered subqueries do not produce a correct ranking.
Question 20
A recursive query must walk a hierarchy of employees and their managers. Which T-SQL feature is designed for this?
- AA recursive common table expression
- BA scalar function called by itself without a base case
- CA nested view with no recursion
- DA cursor that updates every row
Show answer and explanationHide answer
Correct answer: ARecursive CTEs have an anchor member and a recursive member, which suits hierarchical traversal. Nested views cannot recurse, and a function without a base case never ends.
Implement AI capabilities in database solutions (10 questions)
Question 21
A product description column changes often, and the application needs its embeddings kept current automatically. Which approach is most appropriate?
- AA trigger or change-tracking process that regenerates the embedding when the source text changes
- BStore the description as a scanned image instead of plain text, which keeps formatting
- CCompute embeddings in the client on every query, with no vectors saved in the table
- DGenerate embeddings once at load and leave stored vectors unchanged after edits
Show answer and explanationHide answer
Correct answer: ATriggering regeneration when text changes keeps the stored vectors aligned with the source. One-time generation leaves stale vectors, per-query computation adds latency, and images lose the text meaning.
Question 22
A long document must be embedded for retrieval. Why should it be split into chunks before embedding?
- AChunking is required just for image files, since text documents can be embedded in one pass
- BSmaller chunks fit model input limits and give retrieval more precise matches
- CChunks make the document larger so search runs faster, because each piece is indexed
- DChunks remove the need for an index, because short fragments can be compared directly against rows
Show answer and explanationHide answer
Correct answer: BModels have input size limits, and focused chunks improve match precision for retrieval. Chunking does not enlarge documents, index needs remain, and the technique applies to text.
Question 23
Which column should be included in the text used to generate embeddings for a product catalogue?
- AThe name and description fields that describe the product
- BThe audit timestamp recording when each row was last changed
- CA numeric column filled with random numbers generated
- DThe internal row version number, bumped on each write
Show answer and explanationHide answer
Correct answer: ADescriptive text carries the meaning that semantic search needs. Row versions, audit timestamps, and random numbers do not describe the product.
Question 24
A team must choose an embedding model for a multilingual support knowledge base. Which evaluation criterion matters most?
- AThe colour of the model's documentation pages and the palette used in its published guide
- BWhether the model supports the languages used in the content and queries
- CThe name of the engineering team that trained the model version
- DThe number of letters in the model name, counted after removing hyphens from the label
Show answer and explanationHide answer
Correct answer: BLanguage support determines whether meaning is captured across the content and user queries. Documentation colour, team names, and name length do not affect retrieval quality.
Question 25
Which option lets a database call an externally hosted language model with a managed configuration, rather than hard-coding endpoints in every query?
- AA linked spreadsheet workbook kept in shared storage
- BA printed endpoint list kept in a binder for manual reference
- CA comment placed in each stored procedure header
- DAn external model object defined in the database
Show answer and explanationHide answer
Correct answer: DExternal model objects store the endpoint and configuration once, and queries reference them by name. Comments, spreadsheets, and printed lists do not centralize or manage the configuration.
Question 26
A semantic search must find documents with similar meaning to a question, even when they share no keywords. Which search type is needed?
- ASequence number lookup
- BDate range filter
- CVector search
- DExact string match
Show answer and explanationHide answer
Correct answer: CVector search compares embeddings, so it finds semantically similar content without requiring shared words. Exact matches, date filters, and sequence lookups rely on literal values.
Question 27
A search must find product codes exactly as typed, as well as descriptions that mean the same thing. Which search approach fits best?
- AFull-text search alone, using CONTAINS with no synonym expansion
- BHybrid search that combines full-text and vector results
- CA table scan using LIKE with a leading wildcard on every row read
- DVector search alone, comparing query embeddings against stored vectors
Show answer and explanationHide answer
Correct answer: BHybrid search combines exact keyword matching for codes with semantic matching for meaning. Vector-only search can miss exact codes, full-text alone misses synonyms, and table scans are slow.
Question 28
In hybrid search, two ranked result lists from keyword and vector search must be merged into one list. Which technique is commonly used?
- AAdding the raw distances together without normalization
- BSorting alphabetically by document title
- CReciprocal rank fusion (RRF)
- DPicking only the first result from one list
Show answer and explanationHide answer
Correct answer: CRRF combines rankings by rewarding results that rank highly in each list, which avoids mixing incompatible score scales. Raw distances, alphabetical sorting, and single-list picks ignore the other list.
Question 29
A vector search on a very large table is slow. Which approach is designed for fast approximate nearest neighbour search?
- AA scalar function evaluated on every row of the table during the query
- BA full scan with exact distance computation and no index built
- CA vector index that supports approximate nearest neighbour search
- DA clustered index on the text column, ordered by description
Show answer and explanationHide answer
Correct answer: CVector indexes support approximate nearest neighbour search, which trades a small amount of precision for much faster queries. Text indexes, row functions, and exhaustive scans do not provide that speed.
Question 30
When is exact k-nearest-neighbour search preferable to approximate search?
- AWhen the result set is small and perfect recall is required
- BWhen the vectors have no dimensions
- CWhen the table has billions of rows and latency is the main concern
- DWhen only the first character of the text matters
Show answer and explanationHide answer
Correct answer: AExact KNN gives perfect recall at the cost of more computation, which suits small or critical searches. Approximate methods are preferred when latency at scale matters more than perfect recall.
Want more DP-800 questions?
The full bank has 100 questions with answers and explanations, as a PDF, an online practice exam, or both.
Both formats together. The best value.
Instant access after payment, with 90 days of updates. Checkout is on our store, AIExamCerts.