Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with the following group of questions, this is part of a set: Book:

ID: 3773477 • Letter: I

Question

I need help with the following group of questions, this is part of a set:

Book: Microsoft Visual Basic 2012 (8th Edition)

Chapter 8 Knowledge Check.

5) Answer the following questions about the following initiazlied array:

Dim strCityNames (6) as String

A. Assign Detroit to te first array location. What is the index number?

B. Assign Miami to the fourth location in the array. WHat would the assingment statement look like?

C. What value does strCityNames.Length have?

D. How many cities can this array hold?

E. What would happen if you assigned strCityNames(7)="Houston"

Explanation / Answer

A. Assign Detroit to te first array location. What is the index number?

strCityNames(0) = "Detroit" will assign Detroit to the first location of the array. Therefore, the index number is: 0.

B. Assign Miami to the fourth location in the array. WHat would the assingment statement look like?

As the index starts with 0, the 4th location in the array will have an index value of 3. Therefore, assigning Miami to the fourth location looks like this:

strCityNames(3) = "Miami"

C. What value does strCityNames.Length have?

The statement strCityNames.Length will have the value of 7.

D. How many cities can this array hold?

With reference to the previous question, As this array is of length 7, it can hold a total of 7 values, from 0 - 6.

E. What would happen if you assigned strCityNames(7)="Houston"

As the permissible range is only upto 6, the above statement will return an error: Array index out of range.