Which code segment should you choose?

Posted by: Pdfprep Category: GSSP-.NET Tags: , ,

You work as a Software Developer for ABC Inc. The company uses Visual Studio.NET 2005 as its application development platform. You are developing an application that will manage rental properties for a property management agency. When a property is rented, a lease agreement is created. At that time a new lease is entered into the application, the starting date of the lease may not yet be known.

You need to write code that stores the lease start date entered by a user in a variable. The variable that stores the lease start date should contain no value, by default. If no lease start date is entered, the variable should have no value assigned to it.

Which code segment should you choose?
A . DateTime? leaseStartDate = null;
B . DateTime leaseStartDate = null;
C . DateTime? leaseStartDate = new DateTime();
D . DateTime leaseStartDate = new DateTime();

Answer: A

Leave a Reply

Your email address will not be published.