Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1 Which namespace contains LINQ? Question 2 The output of the following

ID: 3717019 • Letter: Q

Question

Question 1

Which namespace contains LINQ?

Question 2

The output of the following code is ______

static void Main(string[] args)

{

int[] nums = { 1, 0, 6, -2, -4, 3};

var posNums = from n in nums where n % 2 == 0 select n;

foreach (int i in posNums)        

Console.Write(i + " ");

}

Question 3

Which of following is correct for the blank?

static void Main(string[] args)

{ int[] nums = { 8, -2, -1, 2, 6, -4, 5 };

int count = /*_________________ */ ;

Console.WriteLine("The number of positive numbers is: " + count);

Console.ReadLine(); }

Question 4

The ________ extension method indicates that only unique values should be included in a LINQ query s results.

Question 5

What is LINQ (Language Integrated Query)?

Question 6

using System;

using System.Linq;

using System.Data.Linq;

using System.Xml.Linq;

using System.Collections;

and that the following array is defined:

string[] colors = { ""green"", ""brown"", ""blue"", ""red"" };

var query = from c in colors where c.Length > 3 orderby c.Length select c;

what type is variable query?

Question 7

In current .NET Framework, what assembly must be included in a project to use the SoundPlayer class?

Question 8

In Generic Method implementation, the ________ clause specifies the type constraint for type parameter T.

Question 9

All arrays implicitly inherit from which generic interface?

Question 10

To avoid having to use fully qualified referenced classes, you could:

System.Text

Explanation / Answer

1)System.Linq
to use LINQ features, System.Linq namesapce shpuld be included

2)0 6 -2 -4 ->(which gives n%2 ==0)

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

//from n in nums where n > 0 select n =>selects and store in array
(from n in nums where n > 0 select n).Count(); =>gives the total count

4)Distinct ->is used to get unique values

5)LINQ =>A query language built into C# that allows data sources to be queried.

6)IEnumerable<string> ->has enumeration of string values

7)System.Media -> support media files

8)where ->clause specifies the type constraint

9) IList ->inherit genricinterface for array

10)Add a using directive. ->used for fully qualified referenced classes

//for any clarification, do comments

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote