To Exam Info

IT 236 -- Practice Final -- July 12, 2005

Part A. Multiple Choice Questions. 5 points each. Give an optional reason for each question.

  1. What is the VB.NET symbol for comment?
       a. /*          b. //          c. <!--          d. '

     

  2. How many times will this loop execute?
    For x = 3 To 20 Step 5
        WriteLine("Line " & x)
    Next
       a. 0          b. 4          c. 5          d. 17          e. 20

     

  3. Which method call moves the focus to the TextBox control t?
       a. t.Enter()    b. t.Focus()    c.  t.MoveFocus()    d. t.Tab()

     

  4. How do you bind the DataSet object ds to the DataGrid control dg?
       a. dg.DataBindings.Add(ds)          b. dg.DataSource = ds
       c. ds.DataBindings.Add(dg)          d. ds.DataSource = dg

     

  5. Which line sets the background color of the PictureBox control p to orange?

    1. p.BackColor = Color.FromArgb(255, 128, 0)

    2. p.bgColor = Color(255, 128, 0)

    3. p.bgColor(Color.Orange)

    4. p.SetBackColor(Color.Red, Color.Yellow)

       

Part B. Problems.  If you cannot give complete VB.Net code to solve the problem, explain what you do understand about the problem.

  1. Construct the program trace and predict the output.
    Public Sub Main()
        Dim x As Integer = 5
        Dim y As Integer
        y = F(x \ 2 + 1) + 3
        WriteLine(y + 4)
    End Sub

    Public Function F(s As Integer) As Integer
        Dim t As Integer = 7
        Dim u As Integer
        If (s * t + 1) Mod 2 = 0 Then
            u = s + 2 * t + 1
        ElseIf
            u = s + 3 * t + 1 
        End If
        Return u + 1
    End Sub 
     

  2. a. Write a function named BeginsAndEndsWithA that returns True if the input string begins with A or a and ends with A or a. It should return False otherwise.
    b. Write a  Main subroutine that invokes your function.




     

  3. The ComboBox control cb contains the abbreviations SUN  MON  TUE  WED  THU  FRI  SAT.  Write the event handler cb_SelectedIndexChanged that will display a message box that will display the day of the week corresponding to the selected abbreviation.





     

  4. Repeat Problem 3, but look up the day of the week in the DaysOfWeek table of the database weekdays.mdb.
    DaysOfWeek Table
    Abbreviation Name
    SUN Sunday
    MON Monday
    TUE Tuesday
    WED Wednesday
    THU Thursday
    FRI Friday
    SAT Saturday


  5. Use several calls of the method g.FillRectangle to draw the letter S in the PictureBox control.  Show only the p_Paint event handler.