Zero seats or a missing key

A map of available seats initially contains K2 → 0 and M7 → 18. Keys use exact string equality, and stored values are nonnegative integers.


For this interface, get returns the stored value or the special marker absent. put stores the supplied value and returns the previous value, or absent for a new key. remove returns the removed value, or absent if the key was missing. containsKey returns true or false.


Complete the result column by applying the operations from top to bottom. Enter exact integers or the words true, false, or absent. Each row asks for the operation's returned result.

OperationReturned result
containsKey(K2)
get(K2)
put(M7, 0)
remove(Z9)
containsKey(M7)
size()

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Map ADT Questions: