CSE 100: Quiz No. 3

Friday, May 7, 1999
10 minutes, closed notes
answers in green


Answer the questions below based on this Visual Basic 6.0 code:

      Private Sub quizQuestion(choice As Integer)
	  Dim index As Integer, side As Integer
	  Dim diceSides(5) As Integer
      
	  For index = 0 To 5
	      diceSides(index) = index + 1
	  Next index
	  
	  side = diceSides(choice)
	  
	  ...
	  
      End Sub
  1. Fill in the blanks:

    The second Dim statement declares an    array    of    six    (how many) values.

  2. How many times will the statement in the loop (diceSides(index) = index + 1) be executed for a single call to quizQuestion?

    six

  3. If the procedure were called with...

    Call quizQuestion(2)

    (a) ...what would be the value of the formal parameter choice?

    2

    (b) ...what would be the value of the local variable side?

    3


Last modified: Fri May 7 17:41:55 PDT 1999