Welcome to the C# Arrays Quiz! This quiz will test your understanding of different types of arrays in C#, including single-dimensional, multidimensional, and jagged arrays. You’ll explore array declarations, initializations, and the distinctions between these various array types. This quiz is designed to reinforce your knowledge and help you master working with arrays in C#.
1.
What is the primary limitation of arrays in C#?
2.
Which of the following is a valid way to declare an array of integers in C#?
3.
How do you initialize an array of strings with values 'red', 'green', and 'blue' in C#?
4.
Which statement correctly declares a 2D array in C#?
5.
What does a 'jagged array' represent in C#?
6.
How do you declare a 3D array in C#?
7.
Which of the following is the correct way to initialize a 2D array in C#?
8.
How do you declare a jagged array in C#?
9.
What is the output of the following code?
string[] colors = { "red", "green", "blue" };
Console.WriteLine(colors[1]);
10.
How do you specify the dimensions of a 2D array in C# when initializing it?
11.
In a jagged array, what does each element represent?
12.
Which of the following correctly initializes a jagged array?