Exam 1z0-809 All QuestionsBrowse all questions from this exam
Question 167

Given that these files exist and are accessible:

/sports/info.txt

/sports/cricket/players.txt

/sports/cricket/data/ODI.txt

and given the code fragment:

int maxDepth =2;

Stream paths = Files.find(Paths.get("/sports"),

maxDepth,

(p, a) -> p.getFileName().toString().endsWith ("txt"),

FileVisitOption.FOLLOW_LINKS);

Long fCount = paths.count();

System.out.println(fCount);

Assuming that there are NO soft-link/symbolic links to any of the files in the directory structure, what is the result?

    Correct Answer: B

    The code is set to find files ending with 'txt' within a maximum depth of 2 from the root directory '/sports'. The files '/sports/info.txt' and '/sports/cricket/players.txt' are within this depth. The file '/sports/cricket/data/ODI.txt' is at a depth of 3, which is beyond the specified maximum depth. Therefore, there are 2 matching files in this search scope.

Discussion
JME_CHGOption: B

B, tested

steefaandOption: B

Answer is B.

WilsonKKerllOption: B

Answer is B.