About Question : enthuware.ocpjp.v8.2.1671

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
razorback
Posts: 4
Joined: Tue Mar 28, 2017 1:25 pm
Contact:

About Question : enthuware.ocpjp.v8.2.1671

Post by razorback »

Hello, in Test 3 question 5 it asks:
What is the state of the WatchKey at the end of the following code?

Path path = Paths.get("C:/temp");
WatchService watchService = FileSystems.getDefault().newWatchService();
path.register(watchService, StandardWatchEventKinds.ENTRY_CREATE,
StandardWatchEventKinds.ENTRY_MODIFY,
StandardWatchEventKinds.ENTRY_DELETE);
WatchKey key = watchService.take();

In my opinion the state for key is ready, because no event has triggered so far.
I understand the api also like that.
If the first event occurs, then the state would become signaled.

But in the answers it says "signaled" is right.

Can you verify please ?

Best regards
Last edited by admin on Tue Mar 28, 2017 9:50 pm, edited 1 time in total.

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

Re: About Question :

Post by admin »

The qid that you have mentioned is for OCAJP 8 question bank but the question belongs to some other question bank. Can you please specify the correct question id or the certification so that I can look it up?

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

razorback
Posts: 4
Joined: Tue Mar 28, 2017 1:25 pm
Contact:

Re: About Question :

Post by razorback »

Sorry, my mistake.

enthuware.ocpjp.v8.2.1671
Test 3, question 5

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

Re: About Question :

Post by admin »

The last line is watchService.take(); The call to take will wait until there is an event. Therefore, the status after this line will be Signaled and not Ready.
If you like our products and services, please help us by posting your review here.

razorback
Posts: 4
Joined: Tue Mar 28, 2017 1:25 pm
Contact:

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

Post by razorback »

Well, after this line it will probably be signaled, maybe not, if no event is triggered in the specified folder.
The question says "at the end of the code", NOT after the code with following events in the folder.

So this is IMO a bit mistakeable and i would still say the answer to the question like it is written is ready, not signaled.

API says: "A watch key has a state. When initially created the key is said to be ready. When an event is detected then the key is signalled "

At the end of the code there is no event, so i am pretty sure the state is ready.

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

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

Post by admin »

I have updated the problem statement to make it clear.

thank you for your feedback!
If you like our products and services, please help us by posting your review here.

razorback
Posts: 4
Joined: Tue Mar 28, 2017 1:25 pm
Contact:

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

Post by razorback »

Thank you.

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests