adplus-dvertising
frame-decoration

Question

For the given set of codes, which query will work according to the set of code?
class Program
{
    static void Main(string[] args)
    {
        int[] nums = { 1, -2, 3, 0, -4, 5 };
        int len = /*_________________ */
        Console.WriteLine("The number of positive values in nums: " + len);
        Console.ReadLine();
    }
}

a.

from n in nums where n > 0
select n

b.

from n in nums where n > 0
select n.Count()

c.

(from n in nums where n > 0
select n).Count();

d.

Both b & c

Posted under C# programming

Answer: (c).(from n in nums where n > 0
select n).Count();

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. For the given set of codes, which query will work according to the set of code?