Multiple Choice
Consider the following pseudocode that returns an Optional value from a method:
if there is a result // line 1
return the result // line 2
else
return an empty result // line 3
Assume that the variable result represents an object reference to the result to be returned as Optional.Replace line 2 with the Java code to return the result.
A) return result.get() ;
B) return Optional.empty() ;
C) return Optional<result>;
D) return Optional.of(result) ;
Correct Answer:

Verified
Correct Answer:
Verified
Q31: Which method causes stream operations to be
Q32: Which of the following is NOT a
Q33: Which statement about higher-order functions is NOT
Q34: Which method yields a stream restricted to
Q35: Which statement creates an array from a
Q37: Complete the following statement that finds the
Q38: Assuming that the variable myStringArrayList has been
Q39: Complete the following statement that uses streams
Q40: Which statement creates a list of the
Q41: Complete the blanks in the following definition:<br>A