137k views
1 vote
What is the return value of isEmpty() method of a map ADT when map has only 1 (key, value)

pair?

(a) 1
(b) true
(c) false
(d) null
(e) none of the above

User Juanagui
by
7.9k points

1 Answer

5 votes

Final answer:

The isEmpty() method returns false for a map with one (key, value) pair, as the map is not empty.

Step-by-step explanation:

The isEmpty() method of a map Abstract Data Type (ADT) is used to determine whether a map contains no key-value pairs. If the map contains no pairs, it is considered empty and the method will return true. Conversely, if the map contains one or more key-value pairs, the method will return false. Since the map in question has one (key, value) pair, it is not empty, and therefore the isEmpty() method would return false.

User ThrowingSpoon
by
7.7k points