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

All questions in C#: using System; using System.Linq; using System.Data.Linq; us

ID: 3718630 • Letter: A

Question

All questions in C#:

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?

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

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

All arrays implicitly inherit from which generic interface?

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

int

Explanation / Answer

what type is variable query?

Answer:

IEnumerable<string>

Explanation:

The compiler translates this query to:

The Where and OrderBy methods, in this case, resolve to Enumerable.Where and Enumerable.OrderBy, which both return IEnumerable<T>. T is inferred to be stringbecause we haven't transformed or projected the input sequence elements in any way.

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

Answer:

Sound

Explanation:

To play a sound using the SoundPlayer class, configure a SoundPlayer with a path to the .wav file and call one of the play methods.

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

Answer:

where

Explanation:

The where clause in a generic definition specifies constraints on the types that are used as arguments for type parameters in a generic type, method, delegate

All arrays implicitly inherit from which generic interface?

Answer:

a and b

Explanation:

All arrays implicitly inherit from the generic interfaces IList and Innumerable with the type of thearray as the type argument, so the string array colors2 implements IEnumerable< string >