Question: vb.net LINQ Practice Problems The following information represents information stored in an array named footballItems. players coaches football goalpost touchdown field goal cheerleaders band After
vb.net
LINQ Practice Problems
The following information represents information stored in an array named footballItems.
players coaches football goalpost touchdown field goal cheerleaders band
After each of the following code segments have been executed, show what the query results will look like based on this data.
1 - Dim sortQuery = From item In footballItems
Order By item
Select item
2 - Dim firstQuery = From item In footballItems
Let first = item.Substring(0, 1)
Order By first Descending
Select first
Distinct
3 In this code segment, assume the user typed in the letter i as in letter.
Dim letter As String
letter = InputBox("Enter a Letter")
letter = letter.ToUpper
Dim letterQuery = From item In footballItems
Where item.Contains(letter)
Select item
When displaying the query results generated by the code above, for which query (queries) would it be appropriate to check the see if the query.Count was 0 to determine which message to display?
The following information represents information stored in an array named runners.
The fields that make up the record are:
Id
Name
Age
Sex
Personal Best Time for 5K
0001,Mary Williams,25,F,24.32
0002,Sue Murrey,48,F,28.10
0003,Randell Jones,37,M,21.45
0004,Jack Peterson,25,M,18.02
After each of the following code segments have been executed, show what the query results will look like based on this data.
4 - Dim maleQuery = From runner In runners
Let data = runner.Split(","c)
Let id = data(0)
Let name = data(1)
Let sex = data(3)
Where sex = "M"
Order By CDbl(data(4)) Ascending
Select id, name
5 - Dim maleQuery = From runner In runners
Let data = runner.Split(","c)
Let id = data(0)
Let name = data(1)
Let sex = data(3)
Let pr = CDbl(data(4))
Order By sex Ascending, pr Descending
Let results = name & ": " & pr.ToString("n2")
Select results
When displaying the output of the two queries shown in questions #4 & #5, how would the line that displays the records that make up the query results differ
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
