Question: 1. Which namespace contains LINQ? System.Text System.Collections.Generic System.Query.Linq System.Linq 2. The output of the following code is ______ static void Main(string[] args) { int[] nums

1. Which namespace contains LINQ?

System.Text
System.Collections.Generic
System.Query.Linq
System.Linq

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 + " ");

}

1 0 6 -2 -4 3
0 6 -2 -4
1 3
Runtime error

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(); }

from n in nums where n > 0 select n
from n in nums where n > 0 select n.Count()
(from n in nums where n > 0 select n).Count();
None of the above

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

Any
Distinct
Count
none of the above

5. What is LINQ (Language Integrated Query)?

An API that allows programmers to write SQL statements.
A query language built into C# that allows data sources to be queried.
The ability for users to input information using their voice.
A .NET Framework.

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?

int
string
IEnumerable
IEnumerable
IQueryable
IQueryable

7.

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

System
System.Media
corelib
Sound

8. If a method is marked as protected internal, who can access it?

Classes that are both in the same assembly and derived from the declaring class.
Only methods that are in the same class as the method in question.
Internal methods can only be called using reflection.
Classes within the same assembly, and classes derived from the declaring class

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

when
constraint
where
cnstr

10. All arrays implicitly inherit from which generic interface?

IList
IEnumerable
IEnumerator
a and b
a and c

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!