Concepts of Computing, Section II

Visual Basic Practice Quiz II

Back to course page.


  1. There is a command button named cmdExit. What is the name of the subroutine that runs when the user clicks this button?

  2. There is a label named lblSum that has a property named Caption. There is a variable named z.

    1. Write the statement that displays 99 in the label's caption.

    2. Write the statement that displays the value of z in the label's caption.

    3. Write the statement that displays the variable name z in the label's caption.

  3. Write the value that x has after running each sequence of statements.

    1.     x = 0
          x = x + 1
          x = 3 * x + 2
          x = 2 * (x + 3)
      
    2.     x = 1
          If x < 5 Then
              x = 0
          End If
          x = x + 1
      
    3.     x = 1
          If x < 2 Then
              x = 0
          Else 
              x = 2
          End If
          x = x + 2
      
    4.     x = 1
          Select Case x
             Case 1
                 x = 1000
             Case 2
                 x = 100
             Case 3
                 x = 10
          End Select
      
  4. This code declares an array:

       Dim s(100) as Integer
    
    1. What is the name of the array?

    2. What is the type of the array?

    3. How many elements are there in the array?

    4. Write the statement to assign the value 12 to the second array element.

    5. Write the statement to print the value of the third array element on the form named frmData.

  5. Write the statement that declares an array named dictionary of type String with 1000 elements.

  6. Write the code that prints the numbers from 1 to 10, each on a line by itself, on the frmCounter frame.

  7. Write the values that i and result have after running these statements:

        result = 0
        For i = 1 To 3
           a(i) = i
           result = result + 2 * a(i)
        Next i
    

Back to top


Jon Jacky, jackyj@evergreen.edu