Chapter quiz · Hashing

Test what you learned.

8 questions on Hashing. Pass 70% to clear the chapter.

← Review chapter lessons

Quiz

Hashing — Chapter Quiz

Eight questions on Map vs Object, Set, WeakMap GC behavior, frequency counting, and LRU caching patterns.

0/ 9
  1. Question 1
    1

    Which JavaScript data structure preserves insertion order AND allows any value (including objects) as a key?

  2. Question 2
    2

    What is the average-case time complexity of Map.get() and Map.set()?

  3. Question 3
    3

    Why can't you iterate over a WeakMap or WeakSet?

  4. Question 4
    4

    What is the idiomatic way to count character frequencies in a string using a Map?

  5. Question 5
    5

    An LRU (Least Recently Used) cache with O(1) get and put can be implemented in JS using:

  6. Question 6
    6

    A plain JavaScript object {} is always a safe drop-in replacement for Map when the keys are strings.

  7. Question 7
    7

    To find whether two strings are anagrams of each other, you can compare their ___ maps (a count of each character).

  8. Question 8
    8

    Which are legitimate use-cases for WeakMap? (Select all that apply)

    Select all that apply.

Pick an answer — instant feedback as you go.