exam questions

Exam 1z0-809 All Questions

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

Exam 1z0-809 topic 1 question 58 discussion

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

Given the code fragment:
String str = "Java is a programming language";
ToIntFunction<String> indexVal = str: : indexOf; //line n1 int x = indexVal.applyAsInt("Java"); //line n2
System.out.println(x);
What is the result?

  • A. 0
  • B. 1
  • C. A compilation error occurs at line n1.
  • D. A compilation error occurs at line n2.
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

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
thetech
Highly Voted 5 years, 1 month ago
Answer is correct.
upvoted 7 times
...
6c84cb9
Most Recent 4 months ago
A, tested
upvoted 1 times
...
6c84cb9
5 months, 1 week ago
A, tested
upvoted 1 times
...
shivkumarx
9 months, 3 weeks ago
Selected Answer: A
A, tested
upvoted 1 times
...
asdfjhfgjuaDCV
10 months, 2 weeks ago
A is the correct answer tested
upvoted 1 times
...
iSnover
11 months ago
Selected Answer: A
A. Tested.
upvoted 1 times
...
steefaand
11 months, 2 weeks ago
Selected Answer: C
C is correct since indexOf requires 2 parameters (object that calls it and its argument). However only 1 parameter is provided.
upvoted 1 times
shivkumarx
9 months, 3 weeks ago
Incorrect, the indexOf() method has an overload which just takes a single string parameter. Correct answer is A
upvoted 1 times
...
...
steefaand
11 months, 2 weeks ago
Selected Answer: C
Line n1 doesnt compile since indexOf requires 2 arguments.
upvoted 1 times
...
WilsonKKerll
2 years, 10 months ago
A. Tested.
upvoted 1 times
...
Samriddji
3 years, 1 month ago
A, tested
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