What is the result?

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?
A. Exception 1
B. Exception 2
C. The program executes, does NOT affect the system, and produces NO output.
D. allemp.txt is created and the content of employee.txt is copied to it.

Download Printable PDF. VALID exam to help you PASS.

7 thoughts on “What is the result?

  1. Exception 1
    because it can’t find the file allemp.txt

    if it was StandardOpenOption.CREATE instead of StandardOpenOption.APPEND
    then it would create the allemp.txt file and copy data from employee.txt

    so correct answer is A

    1. The correct answer is A.

      This program will work as specified in D only if the file “attempt.txt” exists.
      How did you test it? Please, stop posting wrong answers.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.