ExamVeda
Login
Home
LINQ (Language Integrated Query) in C Sharp
?

What will be the output of the following C# code snippet?
static void Main(string[] args)
{
    int[] nums = { 5, 4, 6, 3, 14, 9, 8, 17, 1, 24, -1, 0 };
    Array.Sort(nums);
    int idx = Array.BinarySearch(nums, 14);
    if (idx == 9)
    {
        Console.WriteLine(Convert.ToBoolean(1));
    }
    else
   {
       Console.WriteLine(Convert.ToBoolean(0));
   }
   Console.WriteLine("Index of 14 is " + idx);
   Console.ReadLine();
}

Answer & Solution
Correct Answer: Option C
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.