First time user?    |

#### Select chapter

Basics (5.papers)

1
```How  to produce a sequence of the uppercase and lowercase versions of each word in the original array?
Ex: string[] words = { "aPPLE", "BlUeBeRrY", "cHeRry" };
```
1. ```var lowNums =from n in
numbers where n < 5 select digits[n];```
2. ```var lowNums=from n in
numbers where n<5 select digits[numbers]```
3. `var lowNums=from n in numbers where n<5 select digits[n-1]`
4. `All of the above`
Share
2
```How to produce a sequence of strings representing
the text version of a sequence of ints?
Ex:  int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
string[] strings = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"} ```
1. ```var textNums =from n in numbers
select strings[n];```
2. `var textNums =from n in numbers select new{strings[n]};`
3. `var textNums =from n in numbers select new{n[strings]}`
4. `All of the above`
Share
3
```How  to produce a sequence of the uppercase and lowercase versions of each word in the original array?
Ex: string[] words = { "aPPLE", "BlUeBeRrY", "cHeRry" };```
1. `var upperLowerWords = from w in words select new { Upper = w.ToUpper(), Lower = w.ToLower() };`
2. `var upperLowerWords = from w in words select new { Upper = ToUpper(), Lower=ToLower() };`
3. `var upperLowerWords = words.ToUpper().ToLower();`
4. ` both a and c`
Share
4
```How to produce a sequence containing text
representations of digits and whether their
length is even or odd?
Ex: int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
string[] strings = { "zero", "one", "two", "three",
"four", "five", "six", "seven", "eight", "nine" };```
1. `var digitOddEvens =from n in numbers select new { Digit = strings[n], Even = (n % 2 == 0) };`
2. `var digitOddEvens =from n in numbers select new { Digit = n[strings], Even = (n % 4 == 0) };`
3. `var digitOddEvens =numbers.select new { Digit = n[strings], Even = (n % 4 == 0) };`
4. `None of the above`
Share
5
`How to produce a sequence containing some properties of Products, including UnitPrice which is renamed to Price in the resulting type?`
1. ```var productInfos =from p in products
select new { p.ProductName, p.Category, Price = p.UnitPrice };
```
2. ```Let Price;
var productInfos =from p in products
select new { p.ProductName, p.Category, Price = p.UnitPrice };
```
3. `var productInfos=products.select new{p. ProductName, p.Category, Price = p.UnitPrice };`
4. `both a and c`
Share
6
```How to make a query that returns all pairs of numbers from both arrays such that the number from numbersA is less than the number from numbersB?
Ex:  int[] numbersA = { 0, 2, 4, 5, 6, 8, 9 };
int[] numbersB = { 1, 3, 5, 7, 8 };
```
1. ```var pairs =from a in numbersA from b in numbersB where a < b
select new { a, b };
```
2. ```var pairs =from a in numbersA inner join
from b in numbersB where a < b select  { a, b };
```
3. ```var pairs =from a in numbersA  join
from b in numbersB where a < b select  { a, b };
```
4. `Both b and c`
Share
7
`How to select all orders where the order total is less than 500.00?`
1. `var orders =from c in customers where c.Total < 500.00M select new { c.CustomerID, o.OrderID, o.Total };`
2. `var orders=customers.where(t=>t.Total<500.00M) select new{c.CustomerID,o.OrderID,o.Total};`
3. `var orders=customers.where(t=>t.Toal<500.00M);`
4. `both a and c`
Share
8
`How to select all orders where the order was made in 1998?`
1. `var orders =from c in customers from o in c.Orders  where o.OrderDate >= new DateTime(1998, 1, 1)  select new { c.CustomerID, o.OrderID, o.OrderDate };`
2. `var orders =from c in customers from o in c.Orders   where o.OrderDate >= new DateTime(1, 1, 1998)  select new { c.CustomerID, o.OrderID, o.OrderDate };`
3. `both  a and b`
4. `none of the above`
Share
9
```How to determine if any of the words in the array contain the substring 'ei'?
Ex: string[] words = { "believe", "relief", "receipt", "field" };```
1. `bool iAfterE = words.Any(w => w.Contains("ei"));`
2. ` string iAfterE=words.Any(w=>w.Contains(“ei”));`
3. `int iAfterE=words.Any(w=>w.Exists(“ei”));`
4. `   All of the above`
Share
10
```How to determine whether an array contains only odd numbers?
Ex: int[] numbers = { 1, 11, 3, 19, 41, 65, 19 };```
1. `bool onlyOdd = numbers.All(n => n % 2 == 1);`
2. `bool onlyOdd = numbers.Any(n => n % 2 == 1);`
3. `bool onlyOdd = numbers.At(n => n % 2 == 1);`
4. ` none of the above`
Share
11
`How to return a grouped a list of products only for categories that have all of their products in stock?`
1. ```var productGroups =from p in products group p by p.Category into g
where g.All(p => p.UnitsInStock > 0) select new { Category = g.Key, Products = g };
```
2. `var productGroups =from p in products group p by p.Category into g where g.Any(p => p.UnitsInStock > 0)  select new { Category = g.Key, Products = g };`
3. ```var productGroups =from p in products group p by Category into g  where g.All(p => p.UnitsInStock > 0)   select new { Category = g.Key, Products = g };
```
4. `All of the above`
Share
12
```How where to find all elements of an array less than 5?
EX:  int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };```
1. `var lowNums = from n in numbers where n < 5 select n;`
2. `varlowNums=n.where(t=>t<5)`
3. `both a and b`
4. `none of the above`
Share
13
`How to find all customers in Washington?`
1. `var waCustomers = from c in customers where c.Region == "WA" select c`
2. ```var
waCustomers=customers.where(t=>t.Region==”WA”);```
3. `var waCustomers=customers.where(t=>t.Region==”WA”) select c;`
4. `both a and b`
Share
14
`How to remove duplicate elements in a sequence?`
1. `var remove=List.Distinct();`
2. `var remove=List.ToList()`
3. `var remove=List.Remove()`
4. `var remove=List.Take(5)`
Share
15
`How to find the unique Category names?`
1. `var categoryNames = (from p in products select p.Category) .Distinct();`
2. `var categoryNames=products.select new{p.Category}.Distinct();`
3. ```var categoryNames=products.Category
.Distinct()```
4. `Both and c`
Share
16
`How to create one sequence that contains the unique values from both arrays?`
1. `List1.Union(List2);  `
2. `List1.Concat(List2);`
3. `Both`
4. `None`
Share
17
```How to create one sequence that contains the unique first letter from both product and customer names?

products
customers

ProductNameCompanyName

```
1. `(from p in products select p.ProductName[0]).Union(from c in customers select c.CompanyName[0]);`
2. `(from p in products select p.ProductName[1]).Union(from c in customers select c.CompanyName[1]);`
3. `(from p in products select p.ProductName[0]).Concat(from c in customers select c.CompanyName[0]);`
4. `a and c`
Share
18
```How to create one sequence that contains the common values shared by both arrays?
int[] numbersA = { 0, 2, 4, 5, 6, 8, 9 };
int[] numbersB = { 1, 3, 5, 7, 8 };```
1. `numbersA.Intersect(numbersB);`
2. `numbersA.Union(numbersB);`
3. `numbersA.Mutual(numbersB);  `
4. `None`
Share
19
```) How to create one sequence that contains the common first letter from both product and customer names?

products
customers

ProductNameCompanyName

```
1. `(from p in products select p.ProductName[0]). Intersect(from c in customers select c.CompanyName[0]);`
2. `(from p in products select p.ProductName[0]).Except(from c in customers select c.CompanyName[0]);`
3. `(from p in products select p.ProductName[1]). Intersect (from c in customers select c.CompanyName[1]);`
4. `None`
``` How to create a sequence that contains the values from numbersA that are not also in numbersB?
1. `numbersA.Except(numbersB); `
2. `numbersA.NotIn(numbersB);`
3. `numbersA. Intersect(numbersB);     `
4. `None`