First time user?    |

#### Select chapter

Basics (5.papers)

1
```How to create one sequence that contains the first letters of product names that are not also first letters of customer names?

products
customers

ProductNameCompanyName

```
1. `(from p in products select p.ProductName[0]).Except(from c in customers select c.CompanyName[0]);`
2. `(from p in products select p.ProductName[0]).NotIn(from c in customers select c.CompanyName[0]);`
3. `(from p in products select p.ProductName[0]).NotIn(from c in customers select c.CompanyName[0]);`
4. `None`
Share
2
```How to partition a list of words by their first letter?
string[] words = { "blueberry", "chimpanzee", "abacus", "banana", "apple", "cheese" };```
1. ```var wordGroups = from w in words group w by w[0] into g select new { FirstLetter = g.Key, Words = g };
```
2. ```var wordGroups = from w in words group w by w[1] into g select new { FirstLetter = g.Key, Words = g };
```
3. ```var wordGroups = from w in words group w by w into g select new { FirstLetter = g.Key, Words = g };
```
4. `None`
Share
3
```How to find the first element in the array that starts with 'o'?
string[] strings = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; ```
1. `strings.First(s => s[1] == 'o'); `
2. `strings.First(s => s[0] == 'o');`
3. `strings.Select(s => s[0] == 'o');  `
4. `none                `
Share
Share
Share
6
```How  to get the number of odd ints in the array?
int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };```
1. `numbers.Count(n => n % 3 == 1);  `
2. `numbers.Count(n => n % 2 == 1);`
3. `numbers.Count(n => n % 2 == 0);  `
4. ` none`
Share
7
`How to get the total of the numbers in an array?`
1. `numbers.Sum();`
2. `numbers.Total();`
3. `numbers.Count();              `
4. `none`
Share
8
`How to get the lowest number in an array?`
1. `numbers.Max();`
2. `numbers.High()`
3. `numbers.Min();    `
4. `numbers.Greater();`
Share
9
`How to get the average of all numbers in an array?`
1. `numbers.Avg();`
2. `numbers.Average();   `
3. `numbers.Aggregate();`
4. `numbers.Sum(n+1/2);`
Share
10
`How  to get the highest number in an array?`
1. `numbers.Max();`
2. `numbers.High()`
3. `numbers.Average();`
4. `numbers.Greater();`
Share
11
` How to convert dataset to list using linq ?`
1. `Convert.ToList()`
2. `ToList()`
3. `List.Parse()`
4. `None of the above`
Share
12
`What is the use of linq ?`
1. ` For filtering data`
2. ` For sorting data`
3. `For avoiding duplication`
4. `All of the above`
Share
13
`Linq is applicable only for  ?`
1. `Data Set`
2. `Generic Lists`
3. ` Arrays (Ex. String[], Int[])`
4. `All of the above`
Share
14
` How to convert list to array using linq ?`
1. `To Array()`
2. `To List()`
3. `To String()`
4. ` None of the above`
Share
15
```Generic List  List  lstMembers contains
the below data
Members Details

Nameagesal

Ashok2525000BangaloreSoftware Developer

Kumar2118000BangaloreAssociate Software Developers

How to get member names and age based on whose age is more than 21 and below of 25 ?```
1. `Var  MemberAge=from member in lstMembers where Age between 21 and 25 select member;`
2. `Var  MemberAge=from member in lstMembers where Age>21 and Age<=25 select member;`
3. `Var MemberAge= lstMembers .Where(t => t.Age>=20).Where(t=>t.Age<=22);`
4. `None of the above`
Share
16
```The List lstNames contains below member names.

Name

Ashok

Amar

Pavan

Kumar

Ravi

Vinod

Ram Mohan

Kiran

which below linq get  whose member name starts with “A” ?```
1. `var c=from k in lstNames where k.StartsWith("a") select k;`
2. `var c =lstNames.Where(t => t.StartsWith("a"));`
3. `both a and b`
4. `none of the above`
Share
Share
18
```For the above example which linq returns
the Name and Age as result set ?
```
1. `Var p=from c in lstMembers select p;`
2. ` Var p=from c in lstMembers select {c.Name,c.Aget};`
3. `Var p=from c in lstMembers select new{c.Name,c.Age};`
4. ```Var p=from c in lstMembers
select new{Name,Age};```
Share
19
` The dataset(dismembers) contains the above data. How to filter dataset data based on Address. Who are working in Bangalore.`
1. ```var query = from o in dismembers.ToQueryable()
select o;```
2. ```var query = from o in dismembers.ToEnemarable()
select o;```
3. ` both a and b`
4. `none of the above`
`Which database linq is support?`
1. ` MySql`
2. `  SqlServer`
3. `Oracle`
4. `  All of the above`