Answer the following questions about the following initialized:
Dim strPacificCapitals(11) As String
a. Assign Apia to the first array location. What is the index number?
b. Assign Honiara to the fourth location in the array. What would the assignment statement looks like?
c. What value does strPacificCapitals.Length have?
d. How many capitals can this array hold?
e. What would happen if you assigned strPacificCapitals(11) = “Port Vila”?
Imports System.IO
Module Module1
Sub Main()
Dim strPacificCapitals(11) As String
strPacificCapitals(0) = "Apia"
'a. Assign Apia to the first array location. What is the index number?
'Answer: the index number is 0
'b. Assign Honiara to the fourth location in the array. What would the assignment statement looks like?
strPacificCapitals(3) = "Honiara"
'c. What value does strPacificCapitals.Length have? Answer: 12
Console.WriteLine(strPacificCapitals.Length.ToString())
'd. How many capitals can this array hold? Answer: 12
'e. What would happen if you assigned strPacificCapitals(11) = “Port Vila”?
strPacificCapitals(11) = "Port Vila"
'Answer: nothing. You can assign "Port Vila" to the 11 array location.
Console.ReadLine()
End Sub
End Module
Comments
Leave a comment