Please assist with this questions, thank you! In this exercise, you use what you
ID: 3772440 • Letter: P
Question
Please assist with this questions, thank you!
In this exercise, you use what you have learned about using multidimensional arrays to answer Questions 1–3.
1.
A two-dimensional array declared as Dim MyNums(6,2) As Integer has how many rows?
_______________________________________________________
2.
A two-dimensional array declared as Dim MyNums(6,2) As Integer has how many columns?
_______________________________________________________
3.
Consider the following array declaration: Dim MyNums(6,2) As Integer Are the following Visual Basic statements legal?
Number = MyNums(5,3) ___________________________________
Number = MyNums(0,1) ___________________________________
Number = MyNums(1,2) ___________________________________
Explanation / Answer
The size of an array is the product of the lengths of all its dimensions. It represents the total number of elements currently contained in the array.
1. A two-dimensional array declared as Dim MyNums(6,2) As Integer has how many rows? This has a total of 6+1 = 7 rows.
2. A two-dimensional array declared as Dim MyNums(6,2) As Integer has how many columns? This has a total of 2+1 = 3 coulumns.
3.
onsider the following array declaration: Dim MyNums(6,2) As Integer Are the following Visual Basic statements legal?
Number = MyNums(5,3) This is perfectly legal.
Number = MyNums(0,1) This is also legal.
Number = MyNums(1,2) And ofcourse this is also legal by all means.
An array declared with size MyNums(6,2), will have elements from MyNums(0,0), to MyNums(6,2).