Arrays And Strings In C Sharp - Study Mode
[#91] What is the correct way to declare a string array named colors with three elements in C#?
Correct Answer
(C) string[] colors = {"Red", "Green", "Blue"}
[#92] What is the result of the expression string[] names = {"John", "Alice", "Bob"}
in C#?
Correct Answer
(B) Declares an array with three elements
[#93] What is the correct way to declare a jagged array in C#?
Correct Answer
(D) int[][] jaggedArray
[#94] What is the correct syntax to declare a multidimensional array in C#?
Correct Answer
(B) int[,] matrix
[#95] What will be the output of the following C# code? class Program
{
static void Main(string[] args)
{
String []chars = {"z", "x", "y", "z", "y"}
for (int i = 0
i < chars.Length
++i)
for (int j = i + 1
j < chars.Length
++j)
if(chars[i].CompareTo(chars[j]) == 0)
Console.WriteLine(chars[j])
Console.ReadLine()
}
}
Correct Answer
(C) zy