This question is from Swift Programming Language , especially the domains for Optional types , safe and unsafe unwrapping , and control flow . The code uses the ternary conditional operator :
nextApplePhone.releaseDate != nil ? _____
In Swift, the ternary operator follows this structure:
condition ? valueIfTrue : valueIfFalse
So if nextApplePhone.releaseDate != nil is true, the expression must return the new release date. If it is false, it must keep lastReleaseDate unchanged. That means the missing part must be:
nextApplePhone.releaseDate! : lastReleaseDate
which is option D .
This works because nextApplePhone.releaseDate is declared as String?, so it is an optional. Once the condition confirms it is not nil, the code force-unwraps it with ! to access the underlying String value. If the optional is nil, the expression returns lastReleaseDate instead. Apple’s Swift documentation describes the ternary conditional operator as a shortcut for choosing one of two expressions based on a condition, and it explains that force unwrapping with ! accesses an optional’s wrapped value when you know it is not nil.
The other options are incorrect because they reverse the true/false logic, omit the needed unwrap, or contain invalid identifiers. Therefore, the correct completion is D .