Vidyalelo
C# Programming · Q22

Arrays and Strings in C Sharp

Programming · C# Programming · question 22

Q22

What is the correct way to declare a string array named colors with three elements in C#?

A.
colors[3] = {"Red", "Green", "Blue"};
B.
string[] colors = new string[3];
C.
string[] colors = {"Red", "Green", "Blue"};
Answer
D.
colors = new string[] {"Red", "Green", "Blue"};

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board