Question 1
What is the most significant, yet subtle, difference between a user-defined stored procedure and a system stored procedure in SQL Server?
Only system stored procedures can alter system tables.
User-defined procedures are compiled at runtime, while system procedures are pre-compiled.
System stored procedures are automatically created with every new database, while user-defined ones are not.
System stored procedures are prefixed with 'sp_', and user-defined procedures cannot use this prefix.
Question 2
Which of the following is a valid way to execute a stored procedure named 'GetEmployee' with a parameter '@EmpID' set to 101?
EXECUTE GetEmployee 101;
CALL GetEmployee @EmpID = 101;
PERFORM PROCEDURE GetEmployee WITH @EmpID = 101;
RUN GetEmployee(101);
Question 3
If a stored procedure has two parameters, '@Param1' and '@Param2', what is the default parameter type if not specified?
RETURN
OUT
IN
INOUT
Question 4
What is the primary purpose of the 'OUTPUT' keyword when defining a parameter in a stored procedure?
To ensure the parameter's value is not null.
To specify that the parameter is optional.
To display the parameter's value on the screen.
To allow the stored procedure to modify the parameter's value and pass it back to the calling code.
Question 5
Which of the following is a key advantage of using stored procedures?
They increase network traffic by sending more data to the server.
They make the database schema more difficult to change.
They can be used to encapsulate business logic and improve security.
They are always faster than ad-hoc queries.
Question 6
How would you correctly call a procedure 'Update_Employee' and pass a value to its output parameter '@NewID'?
EXEC Update_Employee INTO @NewID;
EXEC Update_Employee @NewID;
DECLARE @NewID INT; EXEC Update_Employee @NewID OUTPUT;
EXEC Update_Employee GET @NewID;
Question 7
What is the result of executing a stored procedure that has an 'INOUT' parameter?
The procedure returns a table of values.
The parameter's value can only be read by the procedure.
The procedure can only write a value to the parameter.
The parameter's value can be modified by the procedure and the new value is available to the caller.
Question 8
If you want to create a stored procedure that accepts an optional parameter '@Country' with a default value of 'USA', how would you define it?
CREATE PROCEDURE GetCustomers @Country VARCHAR(50) = 'USA'
CREATE PROCEDURE GetCustomers @Country VARCHAR(50) OPTIONAL 'USA'
CREATE PROCEDURE GetCustomers @Country VARCHAR(50) IS 'USA'
CREATE PROCEDURE GetCustomers @Country VARCHAR(50) DEFAULT 'USA'
Question 9
How can a stored procedure return a single, integer status code to the calling environment?
Using an OUTPUT parameter.
Using the EXIT statement.
Using the RETURN statement.
Using a SELECT statement.
Question 10
What is the purpose of the 'AS' keyword in a 'CREATE PROCEDURE' statement?
It is optional and can be omitted.
It assigns an alias to the stored procedure.
It separates the procedure's parameter definitions from its executable code.
It specifies the security context in which the procedure will run.
There are 10 questions to complete.