Quiz 4
comp 125-609, Goldwasser
Tuesday, September 28, 1999

This quiz covers the following cumulative material: (alphabetical, with new topics shown in italics)
  • Reading: Ch 1, 2.1-2.4, 2.5, 3.1, 3.2, 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, Multiline, Name, Picture, Text
  • Events: Click, GotFocus, LostFocus
  • Methods: picbox.Cls, picbox.Print, SetFocus
  • Data Types: Arrays, Boolean, Double, Integer, Long, Single, String
  • Flow of Control: If Blocks, Select Case Blocks, For Loops, Do Loops
  • Files: Open, Input, Write

  • Name: _________________________

    Please Circle the one correct answer. If I can't tell which ONE is circled, it will unfortunately be marked wrong.
    1. Which of the following lines would make a picture box display the output,
     1  2  3 
    
    (A) pic1.Print 1 2 3
    (B) pic1.Print 1; 2; 3
    (C) pic1.Print 1, 2, 3
    (D) pic1.Print 1 & 2 & 3

    2. Which of the following lines would make a picture box display the output,
     1
     2
     3
    
    (A) pic1.Print 1 2 3
    (B) pic1.Print 1; 2; 3
    (C) pic1.Print 1, 2, 3
    (D) pic1.Print 1 & 2 & 3

    3. Which of the following statements is the correct first line in creating an output file named "A:\output.txt"?
    (A) Open "A:\output.txt" For Output As #5
    (B) Write "A:\output.txt" As Output
    (C) Open "A:\output.txt" As #5
    (D) Output #5 As "A:\output.txt" For Write

    4. Assume the file "A:\grades.txt" appears as:
    98
    75
    93
    64
    
    What is the value of the variable Z after the following code exectues?
      Private Sub Form_Load()
        Dim X As Integer, Y as Integer, Z as Integer
    
        Open "A:\grades.txt" For Input As #1
        Input #1 X
        Input #1 Y,Z
        Close #1
      End Sub
    
    (A) 98
    (B) 75
    (C) 93
    (D) 64

    5. Assume the file "A:\data.txt" appears as:
    10
    23,8,15
    43,41,18
    25,26
    45,46
    100,103
    5
    
    What is the value of "numbers(5)" after the following code exectues?
      Private Sub Form_Load()
        Dim X as Integer, numbers(1 to 5) as Integer
        Open "A:\data.txt" For Input As #1
    
        For X = 1 to 5
          Input #1, numbers(X)
        Next X
    
        Close #1
      End Sub
    
    (A) 23
    (B) 43
    (C) 25
    (D) 45