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

Given the content of the employee.txt file:

Every worker is a master.

Given that the employee.txt file is accessible and the file allemp.txt does NOT exist, and the code fragment:

What is the result?

    Correct Answer: A

    The code attempts to read all the lines from the employee.txt file and append them to allemp.txt. Since the StandardOpenOption.APPEND is used, it requires the file allemp.txt to already exist. However, since allemp.txt does not exist, an IOException will be thrown the first time the code tries to append to the file. Therefore, the program will catch the IOException and print "Exception 1".

Discussion
Eason_from_the_futureOption: A

A and if allemp.txt is exist, the content of employee.txt is copied to it.

JME_CHGOption: A

A - tested *

asdfjhfgjuaDCVOption: A

A is the answer

mevltOption: A

The answer is A because the StandardOpenOption.APPEND which requires the file to exist.

JME_CHGOption: C

C - tested