exam questions

Exam 1z0-819 All Questions

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

Exam 1z0-819 topic 1 question 31 discussion

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

Given:
Path p1 = Paths.get(“/scratch/exam/topsecret/answers”);
Path p2 = Paths.get(“/scratch/exam/answers/temp.txt”);
Path p3 = Paths.get(“/scratch/answers/topsecret”);
Which two statements print ..\..\..\answers\topsecret? (Choose two.)

  • A. System.out.print(p3.relativize(p1));
  • B. System.out.print(p2.relativize(p3));
  • C. System.out.print(p1.relativize(p3));
  • D. System.out.print(p3.relativize(p2));
  • E. System.out.print(p1.relativize(p2));
  • F. System.out.print(p2.relativize(p1));
Show Suggested Answer Hide Answer
Suggested Answer: BC 🗳️

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
ASPushkin
5 months ago
Selected Answer: BC
relative paths same current working directory absolute paths one absolute location to another, regardless of the current working directory absolute and relative throws an exception go up three levels to scratch is possible just from A, B cases answer B, C
upvoted 1 times
...
d7bb0b2
1 year ago
Selected Answer: BC
B and C are correct
upvoted 1 times
...
Omnisumem
1 year, 5 months ago
Selected Answer: BC
Tetsted: BC.
upvoted 1 times
...
Stavok
1 year, 6 months ago
Selected Answer: BC
The two statements that print ..\..\..\answers\topsecret are options B and C. In option B, p2.relativize(p3) constructs a relative path from p2 to p3. Since p2 represents the path /scratch/exam/answers/temp.txt, and p3 represents the path /scratch/answers/topsecret, the relative path from p2 to p3 is ..\..\..\answers\topsecret. In option C, p1.relativize(p3) constructs a relative path from p1 to p3. Since p1 represents the path /scratch/exam/topsecret/answers, and p3 represents the path /scratch/answers/topsecret, the relative path from p1 to p3 is also ..\..\..\answers\topsecret
upvoted 2 times
...
Mukes877
1 year, 8 months ago
Selected Answer: BC
B, C is correct others don't give required path
upvoted 3 times
...
TADIEWA
2 years, 1 month ago
B,C are correct
upvoted 1 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