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.Collections.Generic |
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 + " ");
}
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(); |
4. The ________ extension method indicates that only unique values should be included in a LINQ query s results.
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. |
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?
7.
In current .NET Framework, what assembly must be included in a project to use the SoundPlayer class?
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.
10. All arrays implicitly inherit from which generic interface?