Quiz Yourself: Collections

Test your knowledge of .NET collection types.

Collections Quiz

1

Consider the following code:

var messages = new ArrayList();

messages.Add("Hello World!");
messages.Add("Good bye!");

foreach (var message in messages)
{
    Console.WriteLine(message);
}

Which type of the message variable?

A)

string

B)

object

C)

int

D)

string[]

Question 1 of 40 attempted

Get hands-on with 1200+ tech skills courses.