About Question enthuware.ocpjp.v7.2.1368 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
ewebxml
Posts: 77
Joined: Sun Jun 30, 2013 10:04 pm
Contact:

About Question enthuware.ocpjp.v7.2.1368 :

Post by ewebxml »

Because the question states,
"Multiple threads need to access this information but none of them changes it."
This statement indicates that a Hashtable is not required.

Hashtable is synchronized, whereas HashMap is not.

In the scenario stated, synchronization is not required.

Please confirm.

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

Re: About Question enthuware.ocpjp.v7.2.1368 :

Post by admin »

That is correct. That is why the correct answer is option 2, HashMap.
HTH,
Paul.

romsky
Posts: 39
Joined: Thu Jan 29, 2015 4:49 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1368 :

Post by romsky »

When the loading and the accessing the data happens in same time, then the answer is Hashtable.

bioshark.dev
Posts: 3
Joined: Tue Nov 05, 2019 6:22 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1368 :

Post by bioshark.dev »

The question also states:
"Which class would be the most appropriate to store such data if the values need not be kept in a sorted fashion?"

Based on this "wrong" clue I have chosen my answer TreeMap, otherwise HashMap was the clear choice. You even mention this in the explanation:

"TreeMap is used to keep the keys sorted which makes it a little bit slower than HashMap. "

So the question and the explanation is a bit ambiguous and contradictory!

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

Re: About Question enthuware.ocpjp.v7.2.1368 :

Post by admin »

The statement says, "...need NOT be sorted...".

bioshark.dev
Posts: 3
Joined: Tue Nov 05, 2019 6:22 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1368 :

Post by bioshark.dev »

Must have been really tired to have missed that :)

P.S. I've taken and passed the exam yesterday. Big thanks to the entire team at EnthuWare. :cheers:

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests