Question:You need to write a LINQ query to retrieve a list of state hospitals. The results should be sorted and grouped first by county. For each county, the hospitals should be sorted by city. Which of the following LINQ queries would you write? (Choose all that apply.) 

A Visual Basic Code
Dim hsQ = From hspt In hospitals
Order By hspt.County, hspt.City
Group hspt By hspt.County Into hsptGroup = Group
C# Code
var hsQ = from hspt in hospitals
orderby hspt.County, hspt.City
group hspt by hspt.County;
 

B Visual Basic Code
Dim hsQ = From hspt In hospitals
Order By hspt.County
Group hspt By hspt.County Into hsptGroup = Group
Order By hsptGroup.Last.City
C# Code
var hsQ = from hspt in hospitals
orderby hspt.County
group hspt by hspt.County into hsptGroup
orderby hsptGroup.Last().City
select hsptGroup;
 

C Visual Basic Code
Dim hsQ = From hspt In hospitals
Order By hspt.County, hspt.City
Group hspt By hspt.County Into hsptGroup = Group
Order By hsptGroup.First.County
C# Code
var hsQ = from hspt in hospitals
orderby hspt.County
group hspt by hspt.County into hsptGroup
orderby hsptGroup.Key
select hsptGroup;
 

D Visual Basic Code
Dim hsQ = From hspt In hospitals
Order By hspt.City
Group hspt By hspt.County Into hsptGroup = Group
Order By hsptGroup.First.County
C# Code
var hsQ = from hspt in hospitals
orderby hspt.City
group hspt by hspt.County into hsptGroup
orderby hsptGroup.First().County
select hsptGroup;
 

+ Answer
+ Report
Total Preview: 1324

Copyright © 2024. Powered by Intellect Software Ltd