adplus-dvertising
frame-decoration

Question

What will be the output of the given code snippet?
class Program
{
    static void Main(string[] args)
    {
        string[] strs = {"alpha", "beta", "gamma"};
        var chrs = from str in strs
                   let chrArray = str.ToCharArray()
                   from ch in chrArray
                   orderby ch
                   select ch;
        Console.WriteLine("The individual characters in sorted order:");
        foreach (char c in chrs) 
        Console.Write(c + " ");
        Console.WriteLine();
        Console.ReadLine();
    }
}

a.

a a l h a b g m m a p e t a

b.

a a a a a b e g h l m m p t

c.

a g h l m m p t a a a a b e

d.

Run time error

Posted under C# programming

Answer: (b).a a a a a b e g h l m m p t

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of the given code snippet?