C sharp output type question

Q.  Choose the correct one.  

int[] numbers = { 9, 10, 0, 11 };
  
        var nums =
        from n in numbers
        select n + 1;
  
    foreach (var i in nums)
    {
        Console. Write (i+”,”);
    }

- Published on 31 Aug 15

a. 10, 11, 1, 12
b. 10, 11, 12, 13
c. 9, 10, 0, 11
d. None of these

ANSWER: 10, 11, 1, 12
 
The LINQ Select statement has been used to add all the elements in an integer array by one and return the projected collection.
In the above code snippet, an integer type array, named numbers has been instantiated with {9, 10, 0, 11}. The Select operator operates on this numbers array and returns a collection in which every item is added by one.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)