Independence Day Deal! Unlock 25% OFF Today – Limited-Time Offer - 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:

Bette
1 months ago
I'm going to go with option E: The program spontaneously combusts, because that's the only logical conclusion when dealing with file paths in Java.
upvoted 0 times
Oliva
14 days ago
User1: I think option D is correct.
upvoted 0 times
...
...
Sina
2 months 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
Raul
11 days ago
User 3: D sounds right to me too. The important thing is the file gets copied to the /scratch directory.
upvoted 0 times
...
Ellsworth
12 days ago
User 2: Yeah, I agree. /scratch/exam/new.txt is deleted but that's not a big deal.
upvoted 0 times
...
Art
16 days ago
User 1: I think D is the correct answer. A copy of the file is created in the /scratch directory.
upvoted 0 times
...
...
Alison
2 months 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
Alayna
11 days ago
Hmm, interesting. I'm sticking with C, the program throws a NoSuchFileException.
upvoted 0 times
...
Lawrence
19 days ago
Actually, I think it's A, /scratch/exam/new.txt and /scratch/new.txt are deleted.
upvoted 0 times
...
Edwin
2 months ago
I'm not so sure about that. I believe it's B, the program throws a FileAlreadyExistsException.
upvoted 0 times
...
Tomas
2 months ago
I think it's D, a copy of /scratch/exam/new.txt exists in the /scratch directory and /scratch/exam/new.txt is deleted.
upvoted 0 times
...
...
Johnetta
2 months ago
I'm not sure, but I think C is also a possibility because the program might throw a NoSuchFileException.
upvoted 0 times
...
Remedios
2 months ago
I agree with Magda, because the outputFile is copied to the directory before it gets deleted.
upvoted 0 times
...
Magda
2 months ago
I think the answer is D.
upvoted 0 times
...
Alishia
2 months ago
I'm not sure, but I think it might be C.
upvoted 0 times
...
Celestina
2 months ago
I agree with Theola, because the outputFile is copied to the directory and then deleted.
upvoted 0 times
...
Nadine
2 months 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
Lynelle
30 days ago
No, the correct answer is D. A copy of /scratch/exam/new.txt exists in the /scratch directory and /scratch/exam/new.txt is deleted.
upvoted 0 times
...
Ocie
1 months ago
D) A copy of /scratch/exam/new.txt exists in the /scratch directory and /scratch/exam/new.txt is deleted.
upvoted 0 times
...
Titus
1 months ago
C) The program throws a NoSuchFileException.
upvoted 0 times
...
Denny
1 months ago
B) The program throws a FileAlreadyExistsException.
upvoted 0 times
...
Meghann
2 months ago
I think the answer is B.
upvoted 0 times
...
Britt
2 months ago
A) /scratch/exam/new.txt and /scratch/new.txt are deleted.
upvoted 0 times
...
...
Tayna
2 months 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
3 months 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