Which code segment should you insert at line 08?

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

microsoft-exams

4 thoughts on “Which code segment should you insert at line 08?

  1. None are correct.
    A is going to give error when orderDate will be null as it is a nullable(“?”) property.
    as “order.OrderDate.Value != null” will throw exception if OrderDate is null.
    Correct would be “order.OrderDate != null”. Removed (“.Value”).
    So none are correct.
    C wud have been the correct ans if the operator was (>=).

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.