exam questions

Exam 1z0-819 All Questions

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

Exam 1z0-819 topic 1 question 155 discussion

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

Given the code fragment:



You want to validate a path name before the read file. Before validation, all path names should be canonicalized.

Which code inserted on line n1 will accomplish this?

  • A.
  • B.
  • C.
  • D.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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, 1 week ago
Selected Answer: D
answer : D A canonical pathname is both absolute and unique. That means it includes getting absolute path and no removing redundant names (normalization). ABC doesn't include both those operations. D includes it with file.getCanonicalPath();
upvoted 1 times
...
d7bb0b2
6 months, 3 weeks ago
Selected Answer: D
D is correct, only has a bad sintax canonicalPath pass to new Fileins(canonicalPah) no other opcion convert filename to canonical name only this
upvoted 1 times
...
Ashan_Ozlov
10 months, 1 week ago
Selected Answer: B
B is best answer C and D do not compile when tested
upvoted 1 times
...
Stavok
1 year ago
Selected Answer: D
D is correct The file object is created using the filename variable.The getCanonicalPath() method is called on the file object to get the canonical path of the file.The canonicalPath variable is then used to create a new FileInputStream object. This code will ensure that the path name is validated and canonicalized before the file is read.
upvoted 1 times
...
KiraguJohn
1 year ago
D we use file.getCanonicalPath()
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