You are developing an application that uses the Microsoft ADO.NET Entity Framework to retrieve
order information from a Microsoft SQL Server database. The application includes the following
code. (Line numbers are included for reference only.)
The application must meet the following requirements:
Return only orders that have an OrderDate value other than null.
Return only orders that were placed in the year specified in the OrderDate property or in a later
year.
You need to ensure that the application meets the requirements.
Which code segment should you insert at line 08?
A.
Where order.OrderDate.Value != null && order.OrderDate.Value.Year > = year
B.
Where order.OrderDate.Value = = null && order.OrderDate.Value.Year = = year
C.
Where order.OrderDate.HasValue && order.OrderDate.Value.Year = = year
D.
Where order.OrderDate.Value.Year = = year
Explanation:
*For the requirement to use an OrderDate value other than null use:
OrderDate.Value != null
*For the requirement to use an OrderDate value for this year or a later year use:
OrderDate.Value>= year
A
None of the options is correct. Correct question is in the below link:
http://www.aiotestking.com/microsoft/which-code-segment-should-you-insert-at-line-08-13/
OrderDate is Nullable (?) which makes sense to select C
But C ends with == not >=
While A Could cause an exception when accessing the value (.Value != Null) if OrderDate is Null
Yet, He didn’t mention a requirement “Make sure the code doesn’t cause exception”
So basically we should use A based on his requirements, but in the real world of coding we must select C and modify == to be >=
Thanks.
could you please share the files in google drive. I get error in the category Malicious Websites.Your FortiGate Administrator has blocked this category
could you please share the files in google drive. I get error in the category Malicious Websites.Your FortiGate Administrator has blocked this category