A.ThenBy causes a runtime exception if the primary sort key contains null values.
B.ThenBy is only valid on client-side collections, not on IQueryable.
C.ThenBy specifies a secondary sorting criterion after OrderBy in both LINQ-to-Objects and EF Core.
D.ThenBy replaces the original OrderBy sorting logic entirely.
Show answer
C. ThenBy specifies a secondary sorting criterion after OrderBy in both LINQ-to-Objects and EF Core.
ThenBy and ThenByDescending are used after OrderBy or OrderByDescending to perform secondary and subsequent sorting in LINQ queries, translating to SQL ORDER BY column1, column2.
Question 2 · ASP.NET Core · mid
What is the purpose of the [FromQuery] attribute on a controller action parameter?
A.[FromQuery] is redundant because primitive types are always bound from the query string automatically.
B.The parameter will be bound from the request body instead of the query string.
C.Explicitly using [FromQuery] forces model binding to look for the parameter in the query string even if it matches the route template.
D.It causes a model validation error if the parameter is missing from the route.
Show answer
C. Explicitly using [FromQuery] forces model binding to look for the parameter in the query string even if it matches the route template.
By default, ASP.NET Core model binding infers source locations based on parameter types and route templates: complex types come from the request body, route parameters and query strings are inferred from route templates, etc. Explicit attributes like [FromQuery], [FromBody], and [FromRoute] override or clarify binding sources.
Question 3 · async/await · mid
Which of the following statements is true regarding the use of ConfigureAwait(false) in modern ASP.NET Core applications?
public async Task<int> GetDataAsync()
{
var data = await _httpClient.GetStringAsync("https://api.com");
return data.Length;
}
A.It will leak memory because the HttpClient is not disposed within the method.
B.It will throw an InvalidOperationException due to missing Task.Run.
C.It is redundant because ASP.NET Core does not use a SynchronizationContext for requests, but ConfigureAwait(false) is still often used in reusable libraries.
D.It will always deadlock the calling thread in ASP.NET Core applications.
Show answer
A. It will leak memory because the HttpClient is not disposed within the method.
Using async/await all the way down is important, but adding '.ConfigureAwait(false)' is widely recommended in library code to avoid resuming on the original captured synchronization context. In modern ASP.NET Core applications (ASP.NET Core 3.0+), there is no longer a synchronization context for request threads, making ConfigureAwait(false) largely redundant for web apps, though still essential for UI or library code.