Visual Basic
 Ch. 6 Worksheet #12                                                                     
Name -

Evaluate the following code and answer the questions.

Dim intNumbers(9) As Integer    
Dim strStudentID(9) As String    
Dim J As Integer                            
Dim B As Integer
Dim A As Integer

For J = 0 To 9
   intNumbers(J) = 10        
   strStudentID(J) = Str(J)  
Next J

B = 8
A = 2

intNumbers(1) = intNumbers(A) + intNumbers(B)
intNumbers(4) = B + A * intNumbers(6)
intNumbers(5) = intNumbers(B - A - 2)

1. Fill in the elements of the array intNumbers.

intNumbers
0
1
2
3
4
5
6
7
8
9
                   

2. Fill in the elements of the array strStudentID.

strStudentID
0
1
2
3
4
5
6
7
8
9
                   

Assume that the following code executes with the arrays from above.

strStudentID(3) = strStudentID(B) & strStudentID(7)
intNumbers(2) = Val(strStudentID(9))
intNumbers(9) = 58 - A * intNumbers(5)
intNumbers(5) = Val(strStudentID(5)) ^ 2
strStudentID(7) = Str(Int(intNumbers(3) / intNumbers(2))   
' The VB Int function truncates a decimal number into an Integer. For example, Int(5.999) = 5

3. Fill in the elements of the array intNumbers.

intNumbers
0
1
2
3
4
5
6
7
8
9
                   

4. Fill in the elements of the array strStudentID.

strStudentID
0
1
2
3
4
5
6
7
8
9