Vidyalelo
C# Programming · Q36

Arrays and Strings in C Sharp

Programming · C# Programming · question 36

Q36

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

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

Answer: Option C

Solution

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