Practice Midterm Part A. Multiple Choice Questions. Do all ten questions. For each question, give a reason explaining your answer. (4 points for reason, 1 point for correct answer) 1. Which statement is TRUE? (a) A class is derived from an object. (b) A class is a template or blueprint for an object. (c) A class may support properties and methods. (d) Both (b) and (c). (e) None of the above. 2. Which statement is TRUE about a Label control? (a) The text in the Label control cannot be changed by the user at run time. (b) The ForeColor and BackColor properties define the color of the text and the background respectively. (c) The TextAlign property determines the alignment of the text in the Label control. (d) The Text property determines the text appearing in the label. (e) All of the above. 3. Which of the following is NOT an attribute of a good user interface? (a) Consistency (b) Complexity (c) Intuitiveness (d) User-friendliness 4. What does Option Strict On mean? (a) All variables must be defined using Dim, Private, or Public. (b) No While loops can be used, only For loops. (c) No automatic type conversions are allowed. (d) All variables must be strictly initialized. 5. Which statement inserts 6. What is the output of the following code? Dim a = 3, b = 5, c As Integer = 7 WriteLine((b - a = 2 And a * c < 20) & " " & (False Or b <> 5)) (a) False False (b) True False (c) False True (d) True True 7. Which keyword is used to invoke a constructor? (a) Construct (b) Dim (c) New (c) Sub 8. Which statement is FALSE about csv files? (a) csv files are sequential files. (b) A line is considered to be a record. (c) Fields are delimited by a commas. (d) Each line contains at least three fields. 9. Which statement declares a 10 element array of Integer. (a) Dim a(9) As Integer (b) Dim a(10) As Integer (c) Dim a() As Integer = {9} (d) Dim a() As Integer = {10} 10. Which statement is FALSE? (a) A Brush object is needed to draw a string. (b) A Brush object is needed to fill the interior of a circle. (c) A Pen object is needed to draw the outline of a rectangle. (d) A Pen object is needed to draw text in a list box. Part B. Problems. 20 points each. Do only two out of three problems. 1. Write a Windows application that has these controls: Control Type Name +============+===========+ | PictureBox | picInput | | ListBox | lstPoints | | TextBox | txtPoints | +============+===========+ When the user clicks with the mouse in picInput, the application should display the coordinates of the cursor in four places: (a) in the listbox lstPoints, (b) in the textbox txtPoints, (b) in a message box, and (d) in the output file c:\Points.txt. Write the event handler for the picInput.MouseUp event. 2. Write a Windows application that has these controls: Control Type Name Initial Text +=============+===========+============+ | RadioButton | radFemale | "Female" | | RadioButton | radMale | "Male" | | TextBox | txtAve | "" | | Button | btnSubmit | "Submit" | +=============+===========+============+ The input file c:\Students.txt is a csv file with lines that look like this: William,M,3.45 Judy,F,3.97 Write the event handler for the btnSubmit.Click event that computes the average GPA of all the female students if radFemale is checked. It should compute the average GPA of all the male students if radMale is checked. Display the averate GPA in either case in txtAve. Also, write a Form1_Load event handler that instantiates the StreamReader object. 3. (a) Write a user defined function that inputs a positive integer and returns the sum of the number's factors, including 1, but not including the number itself. (b) Write a console application to test the function in (a). (c) Write a windows application to test the function in (a).