Stored procedures and functions in SQL Server enhance database functionality by encapsulating logic and operations. These 30 MCQs cover stored procedures, parameters, user-defined functions, and system stored procedures.
GetEmployeeDetails?
CREATE PROCEDURE statement is executed with a name that already exists?
WITH RECOMPILE option in a stored procedure do?
RETURN keyword is used in a stored procedure?
TRY-CATCH blockSP_RENAME system procedure do?
SP_WHO display?
SP_DEPENDS in SQL Server?
SP_EXECUTESQL do?
SP_TABLES return when executed?
| Qno | Answer (Option with text) |
|---|---|
| 1 | c) CREATE PROCEDURE |
| 2 | a) EXEC GetEmployeeDetails |
| 3 | b) SQL Server throws an error |
| 4 | a) END |
| 5 | b) Forces recompilation of the execution plan on every run |
| 6 | b) To pass values into the procedure |
| 7 | c) OUTPUT |
| 8 | c) The output is ignored |
| 9 | c) EXEC ProcedureName @ParameterName = VALUE |
| 10 | c) Both a and b |
| 11 | a) Scalar UDFs return single values; table-valued UDFs return tables |
| 12 | b) CREATE FUNCTION |
| 13 | a) The function must return a value |
| 14 | b) UDFs cannot modify database objects |
| 15 | b) To return table data as a result of a single query |
| 16 | d) SP_HELP |
| 17 | b) Renames any database object, including tables and columns |
| 18 | a) SP_HELPTEXT |
| 19 | b) Information about current SQL Server users and sessions |
| 20 | b) SP_ADDLOGIN |
| 21 | a) Lists the dependencies of a database object |
| 22 | a) SP_CONFIGURE |
| 23 | a) Executes dynamic SQL queries |
| 24 | b) A list of user-defined and system tables in a database |
| 25 | a) SP_COLUMNS |