Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Oracle Exam 1Z0-819 Topic 5 Question 85 Discussion

Actual exam question for Oracle's 1Z0-819 exam
Question #: 85
Topic #: 5
[All 1Z0-819 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?

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

Sina
4 days ago
D seems like the correct answer to me. Who cares if /scratch/new.txt gets deleted? The important thing is that a copy of the file now exists in the /scratch directory.
upvoted 0 times
...
Alison
7 days ago
Haha, this question is a real head-scratcher! I'm going to have to go with C and say it throws a NoSuchFileException. Can't create a file that doesn't exist, right?
upvoted 0 times
...
Johnetta
11 days ago
I'm not sure, but I think C is also a possibility because the program might throw a NoSuchFileException.
upvoted 0 times
...
Remedios
12 days ago
I agree with Magda, because the outputFile is copied to the directory before it gets deleted.
upvoted 0 times
...
Magda
14 days ago
I think the answer is D.
upvoted 0 times
...
Alishia
17 days ago
I'm not sure, but I think it might be C.
upvoted 0 times
...
Celestina
18 days ago
I agree with Theola, because the outputFile is copied to the directory and then deleted.
upvoted 0 times
...
Nadine
19 days ago
I think the answer is B. The program should throw a FileAlreadyExistsException when trying to create /scratch/exam/new.txt since it already exists.
upvoted 0 times
Britt
4 days ago
A) /scratch/exam/new.txt and /scratch/new.txt are deleted.
upvoted 0 times
...
...
Tayna
20 days ago
The answer is clearly D. The code copies the file to the /scratch directory and then deletes the original file.
upvoted 0 times
...
Theola
27 days ago
I think the answer is D.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77