Class: ______Date: ______ID: A

Class: ______Date: ______ID: A

Name: ________________________ Class: ___________________ Date: __________ ID: A Chapter 8 Test Bank True/False Indicate whether the statement is true or false. ____ 1. One of ASP.NET’s greatest strengths is its ability to access and manipulate databases. ____ 2. In today’s ever-evolving technology environment, it is often necessary for an application to access multiple databases created in different database management systems. ____ 3. ASP.NET includes minimal support for ODBC. ____ 4. By eliminating the ODBC layer, your ASP.NET programs will be faster. ____ 5. ASP.NET code that directly accesses a database is more difficult to write than code that goes through ODBC. ____ 6. To connect to a SQL Server database, you instantiate an object of the SqlConnection class. ____ 7. One SqlConnection object you should use whenever you open a database connection with the Open() method is the Disconnect()method to disconnect the database connection. ____ 8. If you do not close a database connection, it remains open until you open another database. ____ 9. You must first select a database with the USE database statement before you can use it. ____ 10. It is good practice to make sure your program has connected to a database successfully before it attempts to read, write, add, or modify records. ____ 11. Instead of using an if...else block and the State property to determine whether a database connection was successful, you can also execute the Open() method within a try...catch block. ____ 12. You use the ExeReader() method of the SqlCommand class to create a SqlDataReader object, which you must assign to a variable. ____ 13. When a SqlDataReader object is first created, the cursor is initially placed after the first row in the recordset. ____ 14. The first time you use the Read() method, it places the cursor in the first row of the recordset. ____ 15. When you work with recordsets and the Read() method, you can always be certain that there is another record following the current position of the cursor. ____ 16. To determine if a next record is available, you can use the Read() method, which returns a value of true if it finds a next row in the recordset. ____ 17. You cannot execute any other commands against the database until the SqlDataReader object is closed. 1 Name: ________________________ ID: A ____ 18. Closing a SqlDataReader object with the Finished() method allows you to reuse the SqlDataReader object to retrieve other recordsets. ____ 19. A SqlDataReader object has exclusive access to the database SqlConnection object. ____ 20. The ExecuteNonQuery() method is a method of the SqlCommand class and executes commands against a database. ____ 21. You normally use ASP.NET to create databases and tables programmatically. ____ 22. By default, the value of the first row in a field that is created with the IDENTITY keyword is assigned a value of 1 and the value for each subsequently added row is incremented by 1 from the preceding row. ____ 23. When you add records to a table that includes an IDENTITY field, you do not include a field value for the IDENTITY field. ____ 24. The values you enter in the VALUES list can be in any order. ____ 25. You must specify EMPTY in any fields for which you do not have a value. Multiple Choice Identify the choice that best completes the statement or answers the question. ____ 26. ____ allows ODBC-compliant applications to access any data source for which there is an ODBC driver. a. Open Data Connectivity c. Open Database Connectivity b. Open Database Client d. Open Data Client ____ 27. ODBC uses ____ commands to allow an ODBC-compliant application to access a database. a. SQLDB c. DBSQL b. OSQL d. SQL ____ 28. ____ is a Microsoft database connectivity technology that allows ASP and other Web development tools to access ODBC- and OLE DB-compliant databases. a. ActiveX Data Objects c. ActiveX Data Integration b. COM Data Objects d. ActiveX Data Provisioning ____ 29. ____ is a data source connectivity standard promoted by Microsoft as a successor to ODBC. a. COMDB c. OLE DB b. ActiveDB d. OpenDB ____ 30. The components that make up the Universal Data Access technology are called the ____. a. Microsoft Data Components c. Microsoft Database Components b. Microsoft Data Access Components d. Microsoft Data Activity Connection 2 Name: ________________________ ID: A ____ 31. The first step in working with a SQL Server database in ASP.NET is to create an object of the SqlConnection class using the following syntax: ____. a. Object $SqlConnection = new SqlConnection("connection string"); b. SqlConnection object("connection string"); c. SqlConnection object.new("connection string"); d. SqlConnection object = new SqlConnection("connection string"); ____ 32. Once you create an instance of the SqlConnection object, you must use the ____ method to open the specified SQL Server database instance. a. Read() c. Open() b. Start() d. Pull() ____ 33. You can select or change a database with the ____ method of the SqlConnection class. a. ChangeDatabase() c. MarkDatabase() b. Database() d. SwitchDatabase() ____ 34. The ____ object contains various properties and methods for reading the returned data. a. SqlDataWriter c. SqlDataConsumer b. SqlDataProducer d. SqlDataReader ____ 35. When you work with a SqlDataReader object, your position within the recordset is called the ____. a. cursor c. data control b. pointer d. data index ____ 36. The field names in a database table are assigned as variables in a ____ object collection. a. DataReader c. DataProvider b. SqlDataReader d. SqlReader ____ 37. If you instantiate a SqlDataReader object named empRecords for the Employees database, you can refer to the first_name field by using a statement similar to ____. a. empRecords.first_name; b. empRecords(“first_name”); c. empRecords[“first_name”]; d. empRecords.access(“first_name”); ____ 38. Whenever you use the ____ method, the content of each variable in a SqlDataReader object changes to reflect the contents of the record at the current location of the cursor. a. Fetch() c. Pull() b. Read() d. Ingest() ____ 39. When you are through working with a SqlDataReader object, you must close it with the ____ method. a. Close() c. Open() b. Flush() d. Quit() ____ 40. To close an object named empRecords, use the following the statement: ____. a. Close(empRecords); c. empRecords.Close(); b. Close(“empRecords”); d. empRecords.access(“close”); 3 Name: ________________________ ID: A ____ 41. You use the ____ statement with the ExecuteNonQuery() method to create a new database. a. CREATE TABLE c. CREATE DATA b. CREATE INDEX d. CREATE DATABASE ____ 42. To create a table, you use the ____ statement with the ExecuteNonQuery() method. a. CREATE DATABASE c. CREATE DATA b. CREATE TABLE d. CREATE INDEX ____ 43. To identify a field as a primary key, you include the ____ keywords when you first define a field with the CREATE TABLE statement. a. PRIMARY KEY c. PRIME KEY b. INDEX KEY d. FOCAL KEY ____ 44. The ____ keyword is used with a primary key to generate a unique ID for each new row in a table. a. INDEX c. MAIN INDEX b. PRIMARY d. IDENTITY ____ 45. You can specify the starting number and the amount each subsequent row is incremented with the syntax ____. a. IDENTITY[start, increment] b. IDENTITY(start,increment) c. IDENTITY.start(increment) d. IDENTITY.increment(start) ____ 46. To delete a table, you use the ____ statement with the ExecuteNonQuery() function. a. DELETE TABLE c. DROP TABLE b. DELETE STRUCT TABLE d. CLEAR TABLE ____ 47. To add records to a table, you use the INSERT and ____ keywords with the ExecuteNonQuery() method. a. VALUES c. WITH b. DATA d. HAVING ____ 48. To add multiple records to a database, you use the BULK INSERT statement and the ____ function with a local text file containing the records you want to add. a. ExecuteNoReturn() c. ExecuteNoData() b. ExecuteVoid() d. ExecuteNonQuery() ____ 49. The ____ keyword specifies the value to assign to the fields in the records that match the condition in the WHERE keyword. a. ENTER c. FIX b. SET d. HAS ____ 50. To delete records in a table, you use the DELETE and ____ keywords with the ExecuteNonQuery() function. a. WHEN c. WHERE b. WITH d. SUCH 4 ID: A Chapter 8 Test Bank Answer Section TRUE/FALSE 1. ANS: T PTS: 1 REF: 406 2. ANS: T PTS: 1 REF: 406 3. ANS: F PTS: 1 REF: 406 4. ANS: T PTS: 1 REF: 407 5. ANS: F PTS: 1 REF: 407 6. ANS: T PTS: 1 REF: 408 7. ANS: F PTS: 1 REF: 410 8. ANS: F PTS: 1 REF: 410 9. ANS: T PTS: 1 REF: 411 10. ANS: T PTS: 1 REF: 412 11. ANS: T PTS: 1 REF: 414 12. ANS: F PTS: 1 REF: 417 13. ANS: F PTS: 1 REF: 418 14. ANS: T PTS: 1 REF: 418 15. ANS: F PTS: 1 REF: 418 16. ANS: T PTS: 1 REF: 418 17. ANS: T PTS: 1 REF: 419 18. ANS: F PTS: 1 REF: 419 19. ANS: T PTS: 1 REF: 419 20. ANS: T PTS: 1 REF: 421 21. ANS: F PTS: 1 REF: 424 22. ANS: T PTS: 1 REF: 433 23. ANS: T PTS: 1 REF: 433 24. ANS: F PTS: 1 REF: 435 25. ANS: F PTS: 1 REF: 436 MULTIPLE CHOICE 26. ANS: C PTS: 1 REF: 406 27. ANS: D PTS: 1 REF: 406 28. ANS: A PTS: 1 REF: 407 29. ANS: C PTS: 1 REF: 407 30. ANS: B PTS: 1 REF: 407 31.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    7 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us