exam questions

Exam 1z0-808 All Questions

View all questions & answers for the 1z0-808 exam

Exam 1z0-808 topic 1 question 218 discussion

Actual exam question from Oracle's 1z0-808
Question #: 218
Topic #: 1
[All 1z0-808 Questions]

Given the code fragment:

Which code snippet at line 9 prints true?

  • A. Boolean s = p.apply(101); System.out.println(s);
  • B. Boolean s = p.test(100); System.out.println(s); C.
  • D. System.out.println(p.apply(100));
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
akbiyik
5 days, 1 hour ago
Selected Answer: B
Answer is B.
upvoted 1 times
...
carloswork
1 month, 2 weeks ago
Selected Answer: B
Answer is B. To test: public static void main(String[] args) { Predicate<Integer> p = (n) -> n % 2 == 0; Boolean s = p.test(100); System.out.println(s); // Option B }
upvoted 1 times
...
iSnover
2 months ago
Selected Answer: B
The answer is the letter B, the lambda expression informs that the rest of the operation must be "== 0", that is, any even number will print true, so just invoke the method with an even number and assign it to a variable and print it right after, which is what is done in the letter B.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago