Modifying Data - Quiz Explanation

The answers you selected are indicated below, along with text that explains the correct answers.
 
1. When using Design Time Controls to add simple insert, delete, and update functionality to your Web site, why would not you use SQL statements?
Please select the best answer.
  A. SQL statements execute much slower.
  B. This functionality is provided by recordset object methods.
  C. SQL statements cannot be used with Design Time Controls.
  D. Your application requires a custom interface.
  B is the correct answer. B is the correct answer because the recordset object has methods to perform these functions.
Answer A is incorrect because using SQL statements with ADO and script is actually more efficient than using Design Time Controls.
Answer C is incorrect because SQL statements can be used with Design Time Controls. Answer D is incorrect because writing a custom interface generally means that you will not be using Design Time Controls.

2. Which object provides the updateRecord method?
Please select the best answer.
  A. The command object
  B. The Data Environment object
  C. The Button object
  D. The recordset object
  D is the correct answer. D is the correct answer since updateRecord is a recordset object method. Answers A, B, and C are incorrect since they do not have an updateRecord method.

3. The Data Environment is defined in:
Please select the best answer.
  A. The Data View
  B. The Project Explorer
  C. Global.asa
  D. The Recordset Design Time Control
  C is the correct answer. C is the correct answer because the Data Environment is defined in Global.asa when a Data Environment is added to the project. Answers A and B are incorrect because they are windows within Visual InterDev. Answer D is incorrect because it is a "user" of the Data Environment.

4. One of the advantages of directly scripting the Data Environment is:
Please select the best answer.
  A. It enables the Scripting Object Model.
  B. It results in smaller Web pages.
  C. It automatically binds data to controls.
  D. It creates command objects.
  B is the correct answer. B is the correct answer because it produces smaller pages as compared to Design Time Controls. Answer A is incorrect because the Data Environment doesn't enable the Scripting Object Model.Answer C is incorrect because the Data Environment doesn't bind data to controls. Answer D is incorrect because you can use the Data Environment to add a command object, the Data Environment doesn't do it automatically.

5. Within the scope of this module, what is the function of the onclick event handler?
Please select the best answer.
  A. To make changes to the database
  B. To insert a new record
  C. To respond to clicks on HTML button controls
  D. To delete a new record
  Answer C is correct. Answer C is the correct answer because the function of the onclick event handlers was used to respond to button clicks. Answers A, B, and D are incorrect because these actions were performed by the code in the event handlers.

6. To script the Data Environment, why do you need one or more command objects?
Please select the best answer.
  A. To access the database
  B. To establish a database connection
  C. To bind data to Design Time Controls
  D. To navigate within the database
  A is the correct answer. A is the correct answer because the command object is used to access the database using the execute method. Answer B is incorrect because the connection object is used to establish a database connection. Answer C is incorrect because the recordset object is used to bind data to controls. Answer D is incorrect because the recordset object is used to navigate within the recordset.


SQL-Server 2019