Vidyalelo
C# Programming · all questions

LINQ (Language
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

85

Questions

5/5

Page

Pick an option on a question to see the right answer and solution.

Which operator among the following supports the operation of conversion at runtime without generating the exceptions?

Select an option to see the answer and solution.

What will be the output of the following C# code snippet?
class Program
{
    static void Main(string[] args)
    {
        int[] nums = {3, 1, 2, 5, 4};
        var ltAvg = from n in nums
                    let x = nums.Average()
                    where n < x
                    select n;
        Console.WriteLine("The average is " + nums.Average());
        Console.ReadLine();
    }
}

Select an option to see the answer and solution.

Which method will be used to copy content from one array to another array?

Select an option to see the answer and solution.

Choose the correct statement about the IComparer interface in C#?

Select an option to see the answer and solution.

What will be the output of the following C# 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();
    }
}

Select an option to see the answer and solution.