exam questions

Exam 1z0-809 All Questions

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

Exam 1z0-809 topic 1 question 19 discussion

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

The data.doc, data.txt and data.xml files are accessible and contain text.
Given the code fragment:
Stream<Path> paths = Stream.of (Paths. get("data.doc"),
Paths. get("data.txt"),
Paths. get("data.xml"));
paths.filter(s-> s.toString().endWith("txt")).forEach(
s -> {
try {
Files.readAllLines(s)
.stream()
.forEach(System.out::println); //line n1
} catch (IOException e) {
System.out.println("Exception");
}
}
);
What is the result?
data.txt file.

  • A. The program prints the content of
  • B. The program prints: Exception <<The content of the data.txt file>> Exception line n1.
  • C. A compilation error occurs at
  • D. The program prints the content of the three files.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️
Community vote distribution
A (100%)

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Innovation
Highly Voted 4 years, 7 months ago
A. The program prints the content of data.txt file
upvoted 5 times
...
asdfjhfgjuaDCV
Most Recent 5 months, 3 weeks ago
A is the correct answer.Tested
upvoted 1 times
...
iSnover
6 months, 3 weeks ago
Selected Answer: A
The answer is A, because on line 4 there is the "endWith("txt")" method that separates the data.txt file which is the only one to be read.
upvoted 1 times
...
steefaand
6 months, 3 weeks ago
Selected Answer: A
A is correct.
upvoted 1 times
...
M_Jawad
4 years, 7 months ago
the Answer is A
upvoted 3 times
...
adnano1234
4 years, 7 months ago
The correct answer is A
upvoted 3 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:
DP-300
Dublin, 1 minute ago