Practice Questions

Question 1

You need to modify the data present in the Customers table to increase the discount rate by 5%. Which type of SQL statement should you use for this purpose?

  • A. DELETE

  • B. INSERT

  • C. SELECT

  • D. UPDATE

A1:

Answer D is correct. SQL UPDATE statements are used in order to modify existing data. Answer A is incorrect because DELETE statements are used to remove existing data rather than change it. Answer B is incorrect because the INSERT statement is used in order to add new records. Answer C is incorrect because the SELECT statement is used to return existing data records, not to change them.

Question 2

Given the following code, what order will the final result set be in?

 SELECT Count(CustomerID) as CustCount, State  FROM [Customer Data]  GROUP BY State  ORDER BY 2+3 DESC 
  • A. The results will be in ascending order, based on the values stored in the State column.

  • B. The results will be in descending order, based on the values stored in the State column.

  • C. The results will be in ascending order, based on the values stored in the CustCount column.

  • D. The results will be in descending order, based on the values stored in the CustCount column.

  • E. The results will not be ordered.

A2:

Answer E is correct. Although the records in the result set will be grouped by the value in the State field, the use of a constant (in this case, the addition of two constant values) in the ORDER BY clause will cause the result set to be unordered. Answers A and B are incorrect because the State field is being used to determine the aggregate grouping, not for ordering of results. Answers C and D are incorrect because the Count value is only one of the data elements returned and is not used in the ordering of the result set.

Question 3

Which of the following objects would be used with an Access database? [Select all that apply.]

  • A. SqlConnection

  • B. SqlDataAdapter

  • C. OleDbCommand

  • D. OleDbDataReader

  • E. SqlCommand

A3:

Answers C and D are correct. When accessing Jet databases such as Microsoft Access files, you would use the OLE DB data provider, making both the OleDbCommand and OleDbDataReader objects available. Answers A, B, and E are incorrect because the SqlConnection , SqlDataAdapter , and SqlCommand objects are included with the SQL Server data provider rather than the OLE DB data provider.

Question 4

What happens when you invoke the Close method of a SqlConnection object?

  • A. The connection will be maintained until the application invokes the Open method again.

  • B. The connection will be returned to the pool.

  • C. The connection will be terminated and its resources cleared.

  • D. Nothing. It is no longer necessary in .NET to explicitly invoke the Close method.

A4:

Answer B is correct. The connection is returned to a pool and is available to later connections. Answer A is incorrect because the Close method is invoked to end an existing connection, not to keep it open. Answer C is incorrect because the server's connection resources are not immediately cleared. Answer D is incorrect because the Close method is still required in order to terminate an existing connection.

Question 5

Which method of the SqlDataAdapter class would be used to copy data from a SQL Server view to a DataSet named dsText?

  • A. Fill

  • B. InsertCommand

  • C. SelectCommand

  • D. Update

  • E. UpdateCommand

A5:

Answer A is correct. The Fill method copies information from a database to a DataSet . Answers B, C and E are incorrect because InsertCommand , SelectCommand , and UpdateCommand are properties used to specify Command objects rather than methods used to copy information. Answer D is incorrect because the Update method copies information from a DataSet back to the data source, rather than the other way around.

Question 6

Which object within a DataSet would represent an extracted set of data spanning two virtual tables?

  • A. DataTable

  • B. DataRelation

  • C. DataView

  • D. DataRow

  • E. DataColumn

A6:

Answer C is correct. The DataView object is used to return a derived set of data from one or more DataTable objects, thus making answer A incorrect. Answer B is incorrect because a DataRelation object represents a single foreign key/primary key relationship between DataTable objects. Answers D and E are incorrect because a DataTable is made up of collections of DataRow and DataColumn objects, which do not span across multiple tables.

Question 7

Which of the following bits of sample code could be part of a well- formed XML file?

  • A. <Customer>Joe's Garage</Customer>

  • B. <Customer>Joes Garage</customer>

  • C. <Customer>Joes Garage</Customer>

  • D. <Customer>Joe's Garage</customer>

A7:

Answer C is correct. XML tags are case sensitive, so the closing tag must match the opening tag precisely. Therefore, answers B and D are incorrect. If you use an apostrophe in an XML file, it must either be contained in a CDATA section or represented by the &apos; entity. Therefore, answers A and D are incorrect.

Question 8

Which of the following members of the XmlDocument class create or return an XmlNode object? [Select all that apply.]

  • A. CreateAttribute

  • B. CreateElement

  • C. CreateNode

  • D. DocumentElement

  • E. Load

A8:

Answers C and D are correct. The CreateNode method creates a new XmlNode object, and the DocumentElement property returns an XmlNode object representing the root node of the XML file. Answers A and B are incorrect because the CreateAttribute and CreateElement methods are used to create attribute and element nodes, respectively. Answer E is incorrect because the Load method is used to import an XML document.

Question 9

You have created an application that uses optimistic concurrency control to manage data access by multiple users. Users Bob, Mary, and Sal synchronized their local DataSet objects with the data source at 10:30, and all three post updates to the same record within a local DataSet . Mary submits her update at 11:00, Sal submits his at 10:55, and Bob submits his at 11:05. Which value will be present at 11:10, assuming no one else attempts to change the data?

  • A. Mary's value will remain .

  • B. Sal's value will remain.

  • C. Bob's value will remain.

  • D. The original value will remain.

A9:

Answer B is correct. Because your solution uses optimistic concurrency control, only the first changed value (Sal's) will be updated. Mary and Bob will encounter an error when they attempt to post changes to the same record because the underlying data will have changed since the DataSet was last updated, thus making answers A and C incorrect. Answer D is incorrect because the first saved value will overwrite the original value.

Question 10

Which class within the System.IO namespace would be used in order to extract records from a flat file that have a 10-digit integer key, followed by a 20-character customer name string, followed by two time/date fields?

  • A. FileStream

  • B. StreamReader

  • C. BinaryReader

  • D. DataReader

A10:

Answer C is correct. The BinaryReader class is used to support the reading of data by individual data types. Answer A is incorrect because the FileStream class treats any file simply as a stream of bytes and would not be the best choice here. Similarly, Answer B is incorrect because the StreamReader class is used to read data line by line, which would be less efficient than directly reading each data type available in a known format. Answer D is incorrect because the DataReader object is created by the ExecuteReader method of an ADO.NET Command object rather than as a class within the System.IO namespace.



Developing and Implementing WindowsR-based Applications with Visual BasicR. NET and Visual StudioR. NET Exam CramT 2 (Exam 70-306)
Developing and Implementing WindowsR-based Applications with Visual BasicR. NET and Visual StudioR. NET Exam CramT 2 (Exam 70-306)
ISBN: N/A
EAN: N/A
Year: 2002
Pages: 188

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net