Quiz 1 Set A

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Albert Christopher
A
Albert Christopher
Community Contributor
Quizzes Created: 1 | Total Attempts: 248
| Attempts: 248 | Questions: 16
Please wait...
Question 1 / 16
0 %
0/100
Score 0/100
1. Triggers have three parts: the event, the condition, and the action.

Explanation

This statement is true because triggers in programming typically consist of three components: the event, which is the specific action or occurrence that initiates the trigger; the condition, which is a set of criteria that must be met for the trigger to activate; and the action, which is the specific task or set of tasks that the trigger performs when it is activated. These three parts work together to create a trigger that responds to specific events and conditions in a program.

Submit
Please wait...
About This Quiz
Quiz 1 Set A - Quiz

Quiz 1 Set A explores key concepts in database management, focusing on SQL triggers, routines, and procedures. It assesses understanding of their structures, functionalities, and differences, vital for learners in database management.

Personalize your quiz and earn a certificate with your name on it!
2. A procedure is run by calling it by its name.

Explanation

This statement is true because in most programming languages, a procedure or function is executed by calling it by its name. The name of the procedure is used as a reference to locate and execute the code within the procedure. By calling the procedure, the program transfers control to the code inside the procedure and executes it.

Submit
3. SQL-invoked routines can be:

Explanation

SQL-invoked routines can be both procedures and functions. Procedures are a set of SQL statements that perform a specific task and can be called multiple times. Functions, on the other hand, return a single value and can be used in SQL statements. Therefore, both procedures and functions are examples of SQL-invoked routines, making option C the correct answer.

Submit
4. The views are created by executing a CREATE VIEW SQL command.

Explanation

Views in a database are created by executing a CREATE VIEW SQL command. This command allows users to create a virtual table that is based on the result of a query. The view can then be used to retrieve data from multiple tables or to simplify complex queries. By creating views, users can easily access and manipulate data without needing to write complex queries each time. Therefore, the statement that views are created by executing a CREATE VIEW SQL command is true.

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

Explanation

The correct answer is B.

A stored procedure is compiled and its query plan is cached. A is incorrect because stored procedures are faster. C is incorrect because Transact-SQL statements do not have to be shorter in stored procedures. D is incorrect because the same number of commands are available to both.

Submit
6. Constraints are a special case of triggers.

Explanation

Constraints are a special case of triggers because both are used to enforce rules and conditions on the data in a database. However, triggers are specific actions that are automatically executed when a certain event occurs, while constraints are rules that are applied to the data to ensure its integrity and consistency. Therefore, it can be said that constraints are a subset or a special case of triggers, as they are a type of rule that can be enforced through triggers.

Submit
7. A procedure is:

Explanation

A procedure is a set of instructions or a sequence of actions that can be stored within a database. It is given a unique name to identify it and can be called or executed by using that name. Therefore, all of the given options are correct as a procedure is stored within the database, given a unique name, and called by name.

Submit
8. A named set of SQL statements that are considered when a data modification occurs are called:

Explanation

Triggers are a named set of SQL statements that are executed automatically when a specific event, such as a data modification, occurs in the database. They are used to enforce business rules, maintain data integrity, and automate certain actions. Stored procedures, on the other hand, are named sets of SQL statements that are stored in the database and can be executed on demand. Treatments and trapdoors are not relevant terms in the context of SQL.

Submit
9. 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.      

Explanation

A is correct.

The data resides in the Inserted and the Category tables. B is incorrect because the data also resides in the Category table. C is incorrect because the data also resides in the Inserted table. D is incorrect because only UPDATE triggers affect both the Inserted and Deleted tables.

Submit
10. The variables in the triggers are declared using

Explanation

In many programming languages and systems, including databases and event-driven systems, the "@" symbol is commonly used to declare variables in triggers. This symbol is used to differentiate variables from other elements in the code and to indicate that a specific value will be assigned to the variable. Therefore, the correct answer is b) @.

Submit
11. While triggers run automatically, ________ do not and have to be called.

Explanation

Routines are a set of instructions or procedures that need to be explicitly called in order to run. Unlike triggers, which are automatically executed in response to a specific event, routines require manual invocation. Therefore, routines are the correct answer to the question.

Submit
12. All of the following are advantages of SQL-invoked routines EXCEPT:

Explanation

SQL-invoked routines, such as stored procedures or functions, provide several advantages. They enhance efficiency by reducing network traffic and improving performance. They promote sharability by allowing multiple users to access and execute the same routine. They also enhance security by allowing the database administrator to control access and permissions. However, flexibility is not an advantage of SQL-invoked routines as they are predefined and cannot be easily modified or adapted to changing requirements.

Submit
13. All of the following are part of the coding structure for triggers EXCEPT:

Explanation

Triggers in coding are used to automatically perform certain actions when a specific event occurs. The coding structure for triggers typically includes four components: event, condition, action, and selection. The event specifies the trigger point or the event that triggers the action. The condition specifies the criteria that must be met for the trigger to activate. The action specifies the specific task or action that is performed when the trigger is activated. However, selection is not a part of the coding structure for triggers, so the correct answer is C) selection.

Submit
14. A function has only input parameters but can return multiple values.

Explanation

A function can have both input parameters and return a single value or no value at all. However, it cannot directly return multiple values. To return multiple values, we can use data structures like arrays or objects, or we can use output parameters to modify the values of variables passed as arguments to the function. Therefore, the statement that a function can return multiple values is false.

Submit
15. 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.  

Explanation

The correct answer is B.

He needs to delete the data from the Sales table if the rule fails. A is incorrect because the Inserted table can never have any action performed on it other than a SELECT statement. C is incorrect because the trigger cannot know what to do if John doesn’t code for it. D is incorrect because, again, the Inserted table can only have data selected from it.

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

Explanation

Triggers can indeed be used to ensure referential integrity, enforce business rules, create audit trails, and replicate tables. However, triggers can also call other triggers. Therefore, the given statement that triggers cannot call other triggers is incorrect.

Submit
View My Results

Quiz Review Timeline (Updated): Oct 13, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Oct 13, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Oct 09, 2020
    Quiz Created by
    Albert Christopher
Cancel
  • All
    All (16)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Triggers have three parts: the event, the condition, and the action.
A procedure is run by calling it by its name.
SQL-invoked routines can be:
The views are created by executing a CREATE VIEW SQL command.
What makes stored procedures faster than sending a Transact-SQL...
Constraints are a special case of triggers.
A procedure is:
A named set of SQL statements that are considered when a data...
If you insert data into the Category table that has an INSERT trigger...
The variables in the triggers are declared using
While triggers run automatically, ________ do not and have to be...
All of the following are advantages of SQL-invoked routines EXCEPT:
All of the following are part of the coding structure for triggers...
A function has only input parameters but can return multiple values.
John creates a trigger on the Sales table. He is trying to enforce the...
Triggers can be used to ensure referential integrity, enforce business...
Alert!

Advertisement