exam questions

Exam 1z0-816 All Questions

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

Exam 1z0-816 topic 1 question 1 discussion

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

Given the code fragment:
Path currentFile = Paths.get(“/scratch/exam/temp.txt”);
Path outputFile = Paths get(“/scratch/exam/new.txt”);
Path directory = Paths.get(“/scratch/”);
Files.copy(currentFile, outputFile);
Files.copy(outputFile, directory);
Files.delete (outputFile);
The /scratch/exam/temp.txt file exists. The /scratch/exam/new.txt and /scratch/new.txt files do not exist.
What is the result?

  • A. /scratch/exam/new.txt and /scratch/new.txt are deleted.
  • B. The program throws a FileaAlreadyExistsException.
  • C. The program throws a NoSuchFileException.
  • D. A copy of /scratch/exam/new.txt exists in the /scratch directory and /scratch/exam/new.txt is deleted.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
rvv007
6 months, 3 weeks ago
nether of them right correct answer would be 'Compilation error' bcz of line Path outputFile = Paths get( SPACE instead of DOT
upvoted 1 times
...
PontPont
1 year, 3 months ago
Correct Answer: B
upvoted 4 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:
SY0-701
London, 1 minute ago