Java: Which statement about TreeMap and NavigableMap is the strongest interview answer?

Difficulty:

Easy

Questions:

1

Time Limit:

2 minutes

Passing Score:

100%

Question

Which statement about TreeMap and NavigableMap is the strongest interview answer?

  1. TreeMap keeps keys sorted and supports navigation methods like ceiling, floor, higher, and lower.
  2. TreeMap and NavigableMap is mostly a naming style choice and has little effect on runtime or design.
  3. TreeMap and NavigableMap exists mainly to reduce the number of Java files in a project.
  4. TreeMap and NavigableMap matters only for frontend frameworks, not for core Java applications.

Hint

Start with the core rule behind TreeMap and NavigableMap.

Answer and rationale

Correct answer: A. TreeMap keeps keys sorted and supports navigation methods like ceiling, floor, higher, and lower.

TreeMap keeps keys sorted and supports navigation methods like ceiling, floor, higher, and lower. This is the base concept interviewers commonly test first.

Track: Java