Practice Final Part A. Multiple Choice Questions. Give a reason to support each answer (4 pts. for reason, 1 pt. for answer). Do all 10 questions. 1. In which order does data pass through these objects? (a) Database, DataAdapter, Provider, Connection, DataSet, DataGrid. (b) Database, Connection, Provider, DataSet, DataAdapter, DataGrid. (c) Database, Connection, Provider, DataAdapter, DataSet, DataGrid. (d) Database, Provider, Connection, DataAdapter, DataSet, DataGrid. 2. Which of these statements is FALSE? (a) A DataReader can only read rows in a forward-only manner. (b) A DataReader object feeds its data into a DataSet object. (c) When using a DataReader, one must know the exact datatype of the field being read. (d) A DataReader object is created from a Command object. 3. If ds is a DataSet object, what kind of objects are contained in ds.Tables(0).Rows? (a) ArrayItem (b) DataRow (c) Item (d) Row 4. Which of the following statements inserts the number 1,000,000 into a listbox? (a) ListBox1.Add(1,000,000) (b) ListBox1.Insert(1,000,000) (c) ListBox1.Insert("1000000") (d) ListBox1.Items.Add("1000000") 5. An accessor key for a menu is created by using which character in the text property for a MenuItem object? (a) @ (b) $ (c) & (d) = 6. Which of the following lines obtains a color from a ColorDialog object? (a) Dim c As Color = ColorDialog1.Color (b) Dim c As Color = Color.FromARgb(r, g, b) (c) Dim c As Color = Color.ColorName (d) Dim c As Integer = = Color.FromARgb(r, g, b) 7. Which of the following lines displays image number 3 in a picture box? (a) PictureBox1 = ImageList1(3) (b) PictureBox1.Image = Image.FromFile(Images3) (c) PictureBox1.Image = ImageList1.Images(3) (d) PictureBox1.SetImage(ImageList1.Images(3)) 8. What are the guidelines to help you decide to create a property or a method? (a) When referring to data in an object, create a property. (b) When referring to an action, create a method. (c) There is no difference between a method and a property. (d) Both (a) and (b) (e) None of the above. Page 2 9. Which of the following defines the header for the ToString method? (a) Public Overrides Function ToString() As String (b) Public Function ToString() As String (c) Public Sub ToString() (d) Public Sub ToString() As String 10. What is the importance of the Position property of the BindingContext? It indicates (a) the column number of the primary key field. (b) the column number when using a DataReader. (c) the current row in the dataset. (d) the TabIndex of the control currently bound to the dataset. Part B. Problems. Do only 2 out of 3 problems. 1. Explain how to set up a windows application to display the data in the Houses table of RealEstate.mdb in a DataGrid. Here are the fields in the Houses table: ID (Integer), XPos (Single), YPos (Single), Address (String), City (String), NBaths (Single), NBedRooms (Single), Realtor (Integer), Price (Decimal). (a) Explain which objects you obtained from the toolbox and how you set the properties on those objects. (b) Show all the code that you would need to write. 2. Write a Form_Load event handler to copy the XPos and YPos fields from the Houses table of RealEstate.mdb into an ArrayList object a containing House objects with properties having the same names as the fields in the Houses table. See Problem 1 for the field names and their datatypes. Also write a PictureBox1_Paint method to display the House objects from a in PictureBox1. You do NOT have to write the House class. Assume you have a Display method in the House class with header Public Sub Display(g As Graphics). 3. Write a Windows application to detect the cursor position when a click occurs in a picture box and then record this cursor position as a string in the array list a. Then when Save in the main menu is clicked, save the strings in the array list to the csv file c:\Points.csv. Write the code for both of these event handlers: (a) PictureBox1_MouseUp and (b) mnuSave_Click.