Quiz 6
comp 125-609, Goldwasser
Tuesday, 26 October 1999

This quiz covers the following cumulative material: (alphabetical, with new topics shown in italics)
  • Reading: Ch 1, 2.1-2.5, 2.6, 3.1-3.3, 4.1, 4.3 and all class notes, labs and assignments to date
  • Controls: Command Button, Label, Picture Box, Text Box, Timer
  • Properties: Alignment, Caption, Font, ForeColor, Height, Index, Left, Multiline, Name, Picture, Text, Top, Visible, Width
  • Events: Click, GotFocus, LostFocus
  • Methods: picbox.Cls, picbox.Print, SetFocus
  • Data Types: Arrays, Boolean, Control Arrays, Double, Integer, Long, Single, String
  • Flow of Control: If Blocks, Select Case Blocks, For Loops, Do Loops
  • Files: Open, Input, Write
  • Keywords: Load, Preserve, ReDim, Unload
  • Other: using the debugger

  • Name: _________________________

    Please Circle the one correct answer. If I can't tell which ONE is circled, it will unfortunately be marked wrong.
    1. When an End Sub statement is reached in a Sub procedure, execution jumps to
    (A) the statement before the Call statement which invoked the Sub procedure.
    (B) the statement after the Call statement which invoked the Sub procedure.
    (C) the beginning of the event procedure containing the Call statement.
    (D) the end of the event procedure containing the Call statement.

    2. What is the output of the following program when the command button is clicked?
    Private Sub cmdButton_Click()
      Dim a As String, b As String
      picBox.Cls
      a = "e"
      b = "f"
      Call PrintWords(a, b)
      Call PrintWords(b, a)
    End Sub
    
    Private Sub PrintWords(x As String, y As String)
      picBox.Print x; y;
    End Sub
    
    (A) abba
    (B) effe
    (C) xyyx
    (D) nothing

    3. The arguments appearing in a call statement must match the parameters in the appropriate Sub or Function statement in all but one of the following ways. Which one?
    (A) Number of arguments
    (B) Names of arguments
    (C) Data type of arguments
    (D) Order of arguments

    4. Which of the following is NOT a reason for using procedures?
    (A) They break a complex problem down into smaller pieces.
    (B) They make a program run faster.
    (C) They can be reused easily.
    (D) They make it possible for a team of people to work together on a single program.

    5. What will be displayed when the command button is clicked? (this question tests your knowledge of using ByRef and ByVal)
    Private Sub cmdButton_Click()
      Dim x As String, y As String
      x = "tin"
      y = "can"
      Call Mystery(x, y)
      picOutput.Print x; " "; y
    End Sub
    
    Sub Mystery(ByRef x As String, ByVal y As String)
      Dim temp As String
      temp = x
      x = y
      y = temp
    End Sub
    
    (A)tin tin
    (B)can can
    (C)tin can
    (D)can tin