nerdexam
Oracle

1Z0-851 · Question #6

Given: public class Person { private name; public Person(String name) { this.name = name; } public int hashCode() { return 420; } } Which statement is true?

The correct answer is A. The time to find the value from HashMap with a Person key depends on the size of the map. See the full explanation below for the reasoning.

Question

Given: public class Person { private name; public Person(String name) { this.name = name; } public int hashCode() { return 420; } } Which statement is true?

Options

  • AThe time to find the value from HashMap with a Person key depends on the size of the map.
  • BDeleting a Person key from a HashMap will delete all map entries for all keys of type Person.
  • CInserting a second Person object into a HashSet will cause the first Person object to be removed
  • DThe time to determine whether a Person object is contained in a HashSet is constant and does

How the community answered

(54 responses)
  • A
    72% (39)
  • B
    9% (5)
  • C
    15% (8)
  • D
    4% (2)

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice