exam questions

Exam 70-487 All Questions

View all questions & answers for the 70-487 exam

Exam 70-487 topic 2 question 8 discussion

Actual exam question from Microsoft's 70-487
Question #: 8
Topic #: 2
[All 70-487 Questions]

You are adding a new REST service endpoint to the FlightDataController controller. It returns flights from the consolidated data sources only for flights that are late.
You need to write a LINQ to Entities query to extract the required data.
Which code segment should you use?

  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D D
Show Suggested Answer Hide Answer
Suggested Answer: Explanation 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
tiger25
Highly Voted 5 years, 4 months ago
Answer A. We don't need extract all the FlightInfo but only WasLate history so we use IQueryable.
upvoted 19 times
Karel_Gott
5 years, 3 months ago
Agree and don't see any reason to use Enumerable... pls someone who votes for other than Queryable try to explain..
upvoted 2 times
...
zimzimzimma
4 years, 9 months ago
I think it's A too. See here for an IQueryable vs IEnumerable explanation: https://www.codeproject.com/articles/732425/ienumerable-vs-iqueryable#:~:text=While%20querying%20data%20from%20database,server%20side%20with%20all%20filters.
upvoted 1 times
...
...
SephGrave
Highly Voted 5 years, 5 months ago
Option D
upvoted 10 times
...
not2smart
Most Recent 4 years, 10 months ago
The code for LoadHistorical() is missing from the question. This can be found on other web sites. The source of the historical data is XML related. private IEnumerable<HistoricalFlightInfo> LoadHistorical() { return HistoricalDataLoader.LoadHistoricalFlights(); } - I think the answer is D as the join will need to take place client-side between two IEnumerable objects. - Answer A using AsQueryable does not make sense, since the join cannot take place on the server-side and the whole purpose of using AsQueryable is to let the query run server-side for performance. And that will not work.
upvoted 7 times
Dreamchaser1980
4 years, 8 months ago
I validated the answer D on my computer, query is done server side, filtering is done client side.
upvoted 2 times
...
...
Natali
5 years ago
D is right because you send result as REST so if you use “AsQueryable” the result is deferred to the next enumeration of your result. D is not optimized but will works. A will break at runtime. Credits to Rem
upvoted 7 times
mr_
4 years, 10 months ago
I'm not sure if I understood you but .AsEnumerable() will not cause to execute query on the DB imidietely if that is what you meant. In terms of being deferred both methods will work the same here. Method .AsEnumerable() is completly different from .ToList() in that matter.
upvoted 4 times
Jobair
4 years, 8 months ago
According to the following link .AsEnumerable() will load everything in the memory https://stackoverflow.com/questions/3311244/understanding-asenumerable-in-linq-to-sql
upvoted 1 times
...
...
...
Tested38
5 years, 2 months ago
A, C are probably wrong because joins are not supported for azure tables https://docs.microsoft.com/en-us/rest/api/storageservices/query-operators-supported-for-the-table-service
upvoted 1 times
Gorilla
5 years ago
From the question: "The consolidated flight information is stored in a SQL Server database". Nothing about Azure Tables.
upvoted 4 times
...
...
mmk1991
5 years, 3 months ago
Option C seems to enumerate historical twice (in each Where clause) which is IEnumerable, so it seems that option A would be the best in terms of performance.
upvoted 2 times
...
Moca3
5 years, 3 months ago
It's D
upvoted 5 times
...
rj001
5 years, 3 months ago
I'll go for D
upvoted 4 times
...
jenna_3108
5 years, 4 months ago
Should be option D.
upvoted 7 times
...
soni
5 years, 5 months ago
Option B is right as it is Azure
upvoted 3 times
...
Naveenvarma
5 years, 5 months ago
Option A?
upvoted 5 times
...
Naveenvarma
5 years, 5 months ago
Option C.
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...