Java: Which statement about LRU Cache with LinkedHashMap is the strongest interview answer?

Difficulty:

Easy

Questions:

1

Time Limit:

2 minutes

Passing Score:

100%

Question

Which statement about LRU Cache with LinkedHashMap is the strongest interview answer?

  1. LRU Cache with LinkedHashMap is mostly a naming style choice and has little effect on runtime or design.
  2. LRU Cache with LinkedHashMap exists mainly to reduce the number of Java files in a project.
  3. LRU Cache with LinkedHashMap matters only for frontend frameworks, not for core Java applications.
  4. An LRU cache evicts the least recently used item, and LinkedHashMap can model that behavior with access ordering.

Hint

Start with the core rule behind LRU Cache with LinkedHashMap.

Answer and rationale

Correct answer: D. An LRU cache evicts the least recently used item, and LinkedHashMap can model that behavior with access ordering.

An LRU cache evicts the least recently used item, and LinkedHashMap can model that behavior with access ordering. This is the base concept interviewers commonly test first.

Track: Java