Answer to Question #266987 in Visual Basic for Artika

Question #266987

 Answer the following questions about the following initialized array: Dim strSeafood(8) as String.

           a. Assign Oysters to the first array location. What is the index number?

           b. Assign Lobster to the fourth location in the array. What would the assignment statement look like?

           c. What value does strSeafood.Length have?

           d. How many types of seafood can this array hold?

           e. What would happen if you assigned strSeafood(9) = “Red Snapper”?


1
Expert's answer
2021-11-16T13:51:23-0500


Module Module1
    Sub Main()
        Dim strSeafood(8) As String
        'a. Assign Oysters to the first array location. What is the index number? Answer: ZERO
        strSeafood(0) = "Oysters"
        'b. Assign Lobster to the fourth location in the array. What would the assignment statement look like?
        strSeafood(3) = "Lobster"
        'c. What value does strSeafood.Length have? Answer: 9
        Console.WriteLine(strSeafood.Length.ToString())
        'd. How many types of seafood can this array hold? Answer: one type String
        'e. What would happen if you assigned strSeafood(9) = “Red Snapper”? 
        'Answer:An IndexOutOfRangeException exception is thrown when an invalid index is used to access a member of an array or a collection
        strSeafood(9) = "Red Snapper"


        Console.ReadLine()
    End Sub
End Module

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS