SectionA - Theory {40 Marks)
Question 1
ChooseTrue or False·
(10 Marks]
No
Questions
1 The CASEstatement in SQL Server can only be used in
SELECTand WHERE clauses.
2
Temporary tables created within a stored procedure are
automatically dropped when the procedure finishes
execution.
3 Transactions cannot be explicitly started and committed
within a stored procedure.
4
Input parameters in SQL Server stored procedures can be
modified within the procedure.
5
The order in which parameters are defined in a SQL Server
stored procedure must match the order in which they are
passed during the procedure call.
6 The EXECUTEstatement in SQL Server is used to invoke a
stored procedure.
7 Triggers can be used to audit changes to a table by logging
information about INSERT,UPDATE, and DELETEoperations.
8
Parameters in SQL Server stored procedures can have
default values.
9
Cursors in SQL Server are used to iterate through a result set
row by row.
10 SQL Server supports a traditional FOR loop similar to those
found in procedural programming languages.
True {T)
False(F)
Question 2
(6 Marks]
Compare the usage of stored procedures and triggers in SQL Server. When would you prefer
one over the other?
Question 3
What is the fundamental
Server?
[4 Marks]
difference between a BEFOREtrigger and an AFTER trigger in SQL
Question 4
[4 Marks]
Compare local variables and parameters in terms of scope and usage within stored
procedures.
Question 5
[4 Marks]
Discuss the differences between IF statements and the TRY...CATCH construct in SQL Server.
Question 6
(4 Marks]
Compare the use of a cursor and a regular SELECTstatement for iterating over a result set.
2