nerdexam
Oracle

1Z0-805 · Question #57

1Z0-805 Question #57: Real Exam Question with Answer & Explanation

Sign in or unlock 1Z0-805 to reveal the answer and full explanation for question #57. The question stem and answer options stay visible for context.

Question

Given: private static void copyContents() { try ( InputStream fis = new FileInputStream("report1.txt"); OutputStream fos = new FileOutputStream("consolidate.txt"); ) { byte[] buf = new byte[8192]; int i; while ((i = fis.read(buf)) != -1) { fos.write(buf, 0, i); } fis.close(); fis = new FileInputStream("report2.txt"); while ((i = fis.read(buf)) != -1) { fos.write(buf, 0, i); } } What is the result?

Options

  • ACompilation fails due to an error at line 28
  • BCompilation fails due to error at line 15 and 16
  • CThe contents of report1.txt are copied to consolidate.txt. The contents of report2.txt are appended to
  • DThe contents of report1.txt are copied to consolidate.txt. The contents of report2.txt are appended to

Unlock 1Z0-805 to see the answer

You've previewed enough free 1Z0-805 questions. Unlock 1Z0-805 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full 1Z0-805 Practice