Transactions Locks «Prev  Next»

SQL Transactions Locks - Quiz

Each question is worth one point. Select the best answer or answers for each question.
 
1. John has a transaction that attempts to select data from a table. The query takes a very long time. What is the MOST LIKELY reason why this would happen?
Please select the best answer.
  A. A shared lock was already present.
  B. An exclusive lock was already present.
  C. An intent lock was already present.
  D. A schema lock was already present.

2. Winston wishes to make sure that records are locked as soon as they are read. Which locking scheme would he use?
Please select the best answer.
  A. Exclusive
  B. Shared
  C. Optimistic
  D. Pessimistic

3. Louise selects the value of the @@lock_timeout variable and finds out that it contains the value of 1000. What does this indicate?
Please select the best answer.
  A. The system will wait 10 hours and 00 minutes for a deadlock to be freed before it fails.
  B. The system will wait 1000 minutes for a deadlock to be freed before it fails.
  C. The system will wait 1000 seconds for a deadlock to be freed before it fails.
  D. The system will wait 1 second for a deadlock to be freed before it fails.

4. Suppose you begin a transaction. You forget to place a ROLLBACK TRAN in your Transact-SQL procedure, but you did place a COMMIT TRAN in your procedure. What will happen if one of the Transact-SQL statements receives a fatal error?
Please select the best answer.
  A. The statement commits anyway.
  B. The statements that did not produce an error will be committed.
  C. The transaction is rolled back.
  D. An error is produced because the system does not know which path to take to resolve the problem.

5. Which two statements are true about distributed transactions?
Please select all the correct answers.
  A. The server treats them exactly the same as a local transaction.
  B. The DTC service must be running..
  C. Distributed transactions can be run implicitly or explicitly.
  D. Distributed transactions are committed with the COMMIT DISTRIBUTED TRAN Transact-SQL statement.

6. Victoria uses the RAISERROR Transact-SQL statement like this:
RAISERROR ("Fatal Error", 1, 1, @DBID, @DBNAME)
She then tests the value of @@ERROR and finds that it is 0. How could this be if she just raised the error?
Please select the best answer.
  A. She must be testing the wrong variable.
  B. The severity is set to 1 and it should be set to greater than 10.
  C. The @@ERROR variable won’t be set without using the SETERROR option.
  D. The state is set to 1 and it should be set to greater than 10.