About Question enthuware.ocpjp.v8.3.1918 :

Moderator: admin

Post Reply
ramy6_1
Posts: 124
Joined: Wed Feb 12, 2014 2:44 am
Contact:

About Question enthuware.ocpjp.v8.3.1918 :

Post by ramy6_1 » Sun Aug 28, 2016 7:55 am

Hello ,

In description of "enthuware.ocpjp.v8.3.1920" , you mentioned that Files.walk walks the directory in a depth first manner, which means, it processes the children of a directory first before moving to the sibling of the directory.

Accordingly the correct answer should be

a
a/b
a/b/parent
a/a.java

which is different that the selected correct answer option 4.

Kindly clarify.

admin
Site Admin
Posts: 8239
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v8.3.1918 :

Post by admin » Sun Aug 28, 2016 9:55 pm

parent is not a real directory inside b. It is a symbolic link. The first line of the explanation says, "///Files.walk/// method does not follow symbolic links by default.", so there is no reason why it will print a/b/parent after a/b.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

ramy6_1
Posts: 124
Joined: Wed Feb 12, 2014 2:44 am
Contact:

Re: About Question enthuware.ocpjp.v8.3.1918 :

Post by ramy6_1 » Mon Aug 29, 2016 4:47 am

Hello ,
Thanks for your response.

Regardless the parent itself.

Files.walk walks the directory in a depth first manner which means a/b should be processed before a/a.java and that is different than your selected correct answer.

Kindly clarify.

admin
Site Admin
Posts: 8239
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v8.3.1918 :

Post by admin » Mon Aug 29, 2016 9:17 pm

Your interpretation of depth first is incorrect. Depth first simply means it will first process the whichever item it picks first, fully before moving to the next sibling. It doesn't imply anything about ordering. a/b and a/a.java are at the same level. There is no guarantee which one will be picked first. What is guaranteed is that whenever a/b is picked, it will process a/b completely (i.e. it will go inside a/b) before moving to a/a.java.

I will suggest you to google "depth first algorithm" to get a more clear understanding.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.

ramy6_1
Posts: 124
Joined: Wed Feb 12, 2014 2:44 am
Contact:

Re: About Question enthuware.ocpjp.v8.3.1918 :

Post by ramy6_1 » Sat Sep 03, 2016 5:03 am

You are right.
Thanks for clarification.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 6 guests