Quiz 1 Set A

18 Questions | Total Attempts: 44

SettingsSettingsSettings
Please wait...
Quiz 1 Set A


Questions and Answers
  • 1. 
    Construct a stored procedure, named usp_GetLastName, that accepts one input parameter named EmployeeID and returns the last name of the employee.
  • 2. 
    Create stored procedure usp_get_employees_salary_above_35000 that returns all employees’ first and last names for whose salary is above 35000. The result should be sorted by first_name then by last_name alphabetically.
  • 3. 
    A named set of SQL statements that are considered when a data modification occurs are called:
    • A. 

      Stored procedures.

    • B. 

      Treatments.

    • C. 

      Triggers.

    • D. 

      Trapdoors.

  • 4. 
    All of the following are part of the coding structure for triggers EXCEPT:
    • A. 

      A) event.

    • B. 

      B) condition.

    • C. 

      C) selection.

    • D. 

      D) action.

  • 5. 
    While triggers run automatically, ________ do not and have to be called.
    • A. 

      A) trapdoors

    • B. 

      B) routines

    • C. 

      C) selects

    • D. 

      D) updates

  • 6. 
    SQL-invoked routines can be:
    • A. 

      A) procedures.

    • B. 

      B) functions.

    • C. 

      C) all of the above.

    • D. 

      D) none of the above.

  • 7. 
    All of the following are advantages of SQL-invoked routines EXCEPT:
    • A. 

      A) flexibility.

    • B. 

      B) efficiency.

    • C. 

      C) sharability.

    • D. 

      D) security.

  • 8. 
    A procedure is:
    • A. 

      A) stored within the database.

    • B. 

      B) given a unique name.

    • C. 

      C) called by name.

    • D. 

      D) all of the above.

  • 9. 
    Constraints are a special case of triggers.
    • A. 

      True

    • B. 

      False

  • 10. 
    Triggers can be used to ensure referential integrity, enforce business rules, create audit trails and replicate tables, but cannot call other triggers.
    • A. 

      True

    • B. 

      False

  • 11. 
    Triggers have three parts: the event, the condition, and the action.
    • A. 

      True

    • B. 

      False

  • 12. 
    A function has only input parameters but can return multiple values.
    • A. 

      True

    • B. 

      False

  • 13. 
    A procedure is run by calling it by its name.
    • A. 

      True

    • B. 

      False

  • 14. 
    The views are created by executing a CREATE VIEW SQL command.
    • A. 

      True

    • B. 

      False

  • 15. 
    The variables in the triggers are declared using
    • A. 

      A) –

    • B. 

      B) @

    • C. 

      C) /

    • D. 

      D) /@

  • 16. 
    John creates a trigger on the Sales table. He is trying to enforce the business rule that no order can be created (inserted) with a total less than $20. However, it can be updated by a supervisor, if necessary. What must his code do to the Sales table if the test inside the trigger tries to insert an order with a total of $15? Please select the best answer.  
    • A. 

      A.    Delete the row from the Inserted table.

    • B. 

      B.    Delete the row from the Sales table.

    • C. 

      C.    Do nothing; the trigger will do it automatically.

    • D. 

      D.    Delete the row from both the Inserted and the Sales tables.

  • 17. 
    If you insert data into the Category table that has an INSERT trigger on it, what happens to the data when the trigger fires? Please select the best answer.      
    • A. 

      A.    The data resides in the Inserted and the Category tables.

    • B. 

       B.    The data resides in only the Inserted table.

    • C. 

      C.    The data resides in only the Category table.

    • D. 

       D.    The data resides in the Inserted and Deleted tables.

  • 18. 
    What makes stored procedures faster than sending a Transact-SQL statement to SQL Server? Please select the best answer.
    • A. 

           A.    They are not faster.

    • B. 

           B.    The query plan is compiled and cached on the server.

    • C. 

           C.    The Transact-SQL statements are shorter.

    • D. 

          D.    There are less commands available, so parsing time is shorter.

Back to Top Back to top