Examveda

What will be the output of the following C# code snippet?
static void Main(string[] args)
{
    string[] strings = {"beta", "alpha", "gamma"};
    Console.WriteLine("Array elements: ");
    DisplayArray(strings);
    Array.Reverse(strings); 
    Console.WriteLine("Array elements now: ");
    DisplayArray(strings);
    Console.ReadLine();
 }
 public static void DisplayArray(Array array)
 {
     foreach (object o in array)
     {
         Console.Write("{0} ", o);
     }
         Console.WriteLine();
}

A. Array elements:
beta alpha gamma
Array elements now:
ammag ahpla ateb

B. Array elements:
beta alpha gamma
Array elements now:
gamma beta alpha

C. Array elements:
beta alpha gamma
Array elements now:
gamma alpha beta

D. None of the mentioned

Answer: Option C


Join The Discussion

Related Questions on LINQ (Language Integrated Query) in C Sharp