Practice Questions

Question 1

You are developing an application to display medical records. The records to be displayed will be filtered from a large number of records on the basis of choices, such as physician name or patient's age. You do not know at the time you're building the application precisely what filtering the user will want to do. How should you proceed?

  • A. Bind the entire data set to a DataGrid control and let the user scroll to the desired data.

  • B. Use a view on the server to deliver the desired information to a DataGrid control.

  • C. Use a DataView object at runtime to select the data to be displayed on a DataGrid control.

  • D. Use simple data binding to a series of TextBox controls and let the user scroll to the desired data.

A1:

Answer C is correct. For runtime data filtering, you can use a DataView object in your code, together with information input by the user, to select the desired records. Answers A and D are incorrect because manually scrolling through large data sets is difficult and time consuming. Answer B is incorrect because a server-side view requires you to know the desired information at design time rather than at runtime.

Question 2

Which form of data binding must be used when populating a DataGrid component?

  • A. Simple data binding

  • B. One-way data binding

  • C. Two-way data binding

  • D. Complex data binding

A2:

Answer D is correct. Complex data binding involves binding an entire group of data to a control, such as when populating a DataGrid control. Answer A is incorrect because simple data binding involves the association of a single element or value to the bound control, which is not enough to fill a DataGrid. Answers B and C are incorrect because they involve whether changes are made to data within the component, and the proposed scenario could be of either type.

Question 3

You have used simple data binding to display the contents of an array of Order objects. When the user clicks a button, you want to display the next member of the array. What should your code do?

  • A. Increment the Position property of the appropriate BindingContext object

  • B. Decrement the Position property of the appropriate BindingContext object

  • C. Increment the Position property of the appropriate CurrencyManager object

  • D. Decrement the Position property of the appropriate CurrencyManager object

A3:

Answer C is correct. To move forward in a CurrencyManager object, you increment its Position property. The BindingContext object of a form gives you access to a collection of CurrencyManager objects but does not itself directly manage any data bindings. Therefore, answers A and B are incorrect. Answer D is incorrect because decrementing the Position property will move backward in the collection.

Question 4

What is the default data binding behavior when you add a new control to a Windows form?

  • A. The control is not bound to any data source.

  • B. The control is bound to the data source available through the first CurrencyManager object on the form.

  • C. The control is bound to the data source available through the most recent CurrencyManager object on the form.

  • D. The control adds a new CurrencyManager object to the default BindingContext object on the form.

A4:

Answer A is correct. By default, controls on a Windows form are not data bound. Answers B, C, and D are incorrect because they all specify a default data binding. While you can use any of these data binding strategies in code, it's up to you to decide which data binding you would like for a particular control.

Question 5

You have created a form that displays data from the Customers table on a SQL Server database named DB_A as well as from the Orders table on a SQL Server database named DB_B. Which objects will the form create to manage these bindings?

  • A. One CurrencyManager object and one BindingContext object

  • B. One CurrencyManager object and two BindingContext objects

  • C. Two CurrencyManager objects and one BindingContext object

  • D. Two CurrencyManager objects and two BindingContext objects

A5:

Answer C is correct. Each distinct data source on a bound form requires its own CurrencyManager object to keep track of the current row position. The BindingContext object of a form maintains a collection of all the CurrencyManager objects on the form. Answers A, B, and D are all incorrect.

Question 6

Which of the following events would be triggered by incrementing the Position property of a CurrencyManager object by one? [Select all that apply.]

  • A. CurrentChanged

  • B. ItemChanged

  • C. ValueChanged

  • D. PositionChanged

A6:

Answers A and D are correct. When the Position value is changed, the PositionChanged and CurrentChanged events fire. Answer B is incorrect because the ItemChanged value fires when the underlying data is changed by an external action. Answer C is incorrect because there is no ValueChanged event defined within the CurrencyManager class.

Question 7

Which of the following controls can you bind more than one data source to at the same time?

  • A. TextBox

  • B. CheckBox

  • C. ListBox

  • D. Label

A7:

Answer C is correct. You may bind multiple data sources to the same ListBox control, allowing the control to provide a link between the underlying data sources. Answers A, B, and D are incorrect because these controls only display information from a single data binding at one time.

Question 8

Which of the following DataGrid control properties specifies the color to use on odd-numbered rows in the grid?

  • A. BackColor

  • B. BackgroundColor

  • C. AlternatingBackColor

  • D. ParentRowBackColor

  • E. SelectionBackColor

A8:

Answer A is correct. The BackColor property specifies the color to be used for odd-numbered rows on the grid. The AlternatingBackColor property specifies the color to be used for even-numbered rows, thus making answer C incorrect. Answer B is incorrect because the BackgroundColor property specifies the color to be used to fill any area without data. Answer D is incorrect because the ParentRowBackColor property specifies the color to be used for the background of the parent row's area. Finally, the SelectionBackColor property specifies the color to be used to highlight currently selected cells , thus making answer E incorrect as well.

Question 9

You have a large database made up of Customer and Order records, linked by a CustomerID field. You want to provide access to all open orders from customers located in Texas, sorted by customer. What is the best solution to fulfill this requirement in the most efficient manner?

  • A. Create a lookup view on the server to translate each Order.CustomerID value into its State value and sort by state for "Texas".

  • B. Create a view on the server that limits the result set to records with a related address State value of "Texas".

  • C. Bind the table to a DataView component and restrict the records to those with a State value of "Texas".

  • D. Create a view on the server to translate each Order.CustomerID value into its State value and filter the records to include only those of "Texas".

A9:

Answer B is correct. The best solution is to create a server-side multitable view that filters for open records in the Orders table that are related to customers with a Customers.State value of "Texas". Answers A and D are incorrect because both involve the translation of an order's CustomerID into its related State value, which would prevent sorting by customer without adding an additional field. The requirement mandates the most efficient method, making answer C incorrect because a client-side filtering solution will require that all data be sent to the client first and then filtered.

Question 10

You have expanded Server Explorer to display the Views node under a SQL Server database. You drag and drop one of the contained views to a Windows form. Which object will Visual Studio .NET create on the form as a result?

  • A. SqlDataAdapter

  • B. SqlCommand

  • C. DataView

  • D. OleDbCommand

A10:

Answer A is correct. When you drag and drop a SQL Server table or view, new SqlDataAdapter and SqlConnection objects will be created on your form. Answer B is incorrect because SQL Server stored procedures and table-valued functions dropped on the form will create new objects of the SqlCommand class. Answer C is incorrect because DataView objects are created in code rather than by drag-and-drop operations. Answer D is incorrect because SQL Server databases create objects in the System.Data.SqlClient namespace, not in the System.Data.OleDb 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