Quiz 3
comp 125-609, Goldwasser
Tuesday, September 21, 1999

This quiz covers the following cumulative material: (alphabetical, with new topics shown in italics)
  • Reading: Ch 1, 2.1-2.4, 3.1, 3.2, 3.3, 4.1 and all class notes, labs and assignments to date
  • Controls: Command Button, Label, Picture Box, Text Box, Timer
  • Properties: Alignment, Caption, Font, ForeColor, Multiline, Name, Picture, Text
  • Events: Click, GotFocus, LostFocus
  • Methods: SetFocus
  • Data Types: arrays, Boolean, Double, Integer, Long, Single, String
  • Flow of Control: If Blocks, Select Case Blocks, For Loops, Do Loops

  • Name: _________________________

    Please Circle the one correct answer. If I can't tell which ONE is circled, it will unfortunately be marked wrong.
    1. What is the value of Z after the following section of code executes?
      Dim X As Integer, Z As String
    
      Z = "Stop "
      For X = 1 to 4
        Z = "Go " & Z
      Next X
    
    (A) "Go Go Go Go Stop "
    (B) "Go Stop Stop Stop Stop "
    (C) "Stop Stop Stop Stop Go "
    (D) "Stop Go Go Go Go "

    2. What is the value of X after the following section of code executes?
      Dim X As Integer
    
      X = 3
      Do While X < 15
        X = 2 * X - 1
      Loop
    
    (A) 3
    (B) 15
    (C) 17
    (D) 27

    3. What is the value of X after the following section of code executes?
      Dim a(1 to 20) As Integer, X as Integer
    
      a(5) = 1
      a(8) = 2
      a(13) = 4
    
      X = a(5+8)
    
    (A) 1
    (B) 2
    (C) 3
    (D) 4

    4. What is the value of answer after the following section of code executes?
      Dim X As Integer, box(1 to 10) As Integer, answer As Integer
    
      For X = 1 to 10
        box(X) = 2*X
      Next X
    
      answer = box(7) + box(3)
    
    (A) 10
    (B) 14
    (C) 20
    (D) 30

    5. What is the value of Y after the following section of code executes?
      Dim X As Integer, Y As Integer, loyola(1 to 3) As Integer
    
      For X = 1 to 3
        loyola(X) = 1
      Next X
    
      For X = 2 to 3
        loyola(X) = X*loyola(X-1)
      Next X
    
      Y = loyola(3)
    
    (A) 1
    (B) 3
    (C) 4
    (D) 6