|
| 1 | +### YamlMime:ModuleUnit |
| 2 | +uid: learn.wwl.implement-programmability-objects.knowledge-check |
| 3 | +title: Knowledge check |
| 4 | +metadata: |
| 5 | + title: Knowledge check |
| 6 | + description: "Test your understanding of SQL Server programmability objects" |
| 7 | + ms.date: 01/22/2026 |
| 8 | + author: JulianePadrao |
| 9 | + ms.author: jupadrao |
| 10 | + ms.topic: unit |
| 11 | +azureSandbox: false |
| 12 | +durationInMinutes: 3 |
| 13 | +quiz: |
| 14 | + title: Check your knowledge |
| 15 | + questions: |
| 16 | + - content: "Which programmability object should you use when you need to simplify a complex query that joins multiple tables and expose only specific columns to users?" |
| 17 | + choices: |
| 18 | + - content: "Stored procedure" |
| 19 | + isCorrect: false |
| 20 | + explanation: "Stored procedures are better suited for operations that modify data or contain procedural logic. Views are more appropriate for simplifying read queries." |
| 21 | + - content: "View" |
| 22 | + isCorrect: true |
| 23 | + explanation: "Views act as virtual tables that encapsulate SELECT queries, making them ideal for simplifying complex joins and controlling which columns users can access." |
| 24 | + - content: "Trigger" |
| 25 | + isCorrect: false |
| 26 | + explanation: "Triggers automatically execute in response to data modifications or database events. They aren't designed for simplifying query access." |
| 27 | + - content: "Scalar function" |
| 28 | + isCorrect: false |
| 29 | + explanation: "Scalar functions return single values and are used for calculations, not for simplifying multi-table queries." |
| 30 | + - content: "What is a key advantage of using stored procedures over embedding T-SQL directly in application code?" |
| 31 | + choices: |
| 32 | + - content: "Stored procedures automatically create indexed views" |
| 33 | + isCorrect: false |
| 34 | + explanation: "Stored procedures don't automatically create indexed views. This is unrelated to the benefits of stored procedures." |
| 35 | + - content: "Stored procedures are precompiled and can include transaction management and error handling" |
| 36 | + isCorrect: true |
| 37 | + explanation: "Stored procedures are precompiled for better performance, support transaction management with BEGIN TRANSACTION/COMMIT/ROLLBACK, and include TRY...CATCH error handling." |
| 38 | + - content: "Stored procedures can only be executed by database administrators" |
| 39 | + isCorrect: false |
| 40 | + explanation: "Stored procedures can be granted EXECUTE permissions to any user or role, not just administrators." |
| 41 | + - content: "Stored procedures automatically encrypt all data" |
| 42 | + isCorrect: false |
| 43 | + explanation: "Stored procedures don't automatically encrypt data. Data encryption requires separate implementation." |
| 44 | + - content: "When should you choose a table-valued function over a scalar function?" |
| 45 | + choices: |
| 46 | + - content: "When you need to return a single calculated value" |
| 47 | + isCorrect: false |
| 48 | + explanation: "Scalar functions return single values. Use a scalar function when you need a single calculated result." |
| 49 | + - content: "When you need to modify data in the database" |
| 50 | + isCorrect: false |
| 51 | + explanation: "Neither scalar nor table-valued functions can modify data. Use stored procedures for data modifications." |
| 52 | + - content: "When you need to return a result set that can be used in a FROM clause" |
| 53 | + isCorrect: true |
| 54 | + explanation: "Table-valued functions return result sets that can be joined with other tables or used in FROM clauses, making them ideal when you need to return multiple rows." |
| 55 | + - content: "When you need automatic execution on data changes" |
| 56 | + isCorrect: false |
| 57 | + explanation: "Triggers execute automatically on data changes, not functions." |
| 58 | + - content: "Which type of trigger executes automatically when data is inserted, updated, or deleted in a table?" |
| 59 | + choices: |
| 60 | + - content: "DDL trigger" |
| 61 | + isCorrect: false |
| 62 | + explanation: "DDL triggers respond to schema changes like CREATE, ALTER, and DROP statements, not data modifications." |
| 63 | + - content: "Logon trigger" |
| 64 | + isCorrect: false |
| 65 | + explanation: "Logon triggers execute when a user session is established, not when data is modified." |
| 66 | + - content: "DML trigger" |
| 67 | + isCorrect: true |
| 68 | + explanation: "DML (Data Manipulation Language) triggers fire automatically in response to INSERT, UPDATE, or DELETE operations on tables or views." |
| 69 | + - content: "Schema trigger" |
| 70 | + isCorrect: false |
| 71 | + explanation: "Schema trigger isn't a standard SQL Server trigger type. DDL triggers handle schema-related events." |
0 commit comments