In the context of this exercise, does every compression function need to use modulo?
No, every compression function does not need to use modulo. Instead, every compression function should be able to map to valid indices of the hash map, whether it utilizes modulo or another method.
One possible method, without using modulo, might be to utilize the first and last indices of the array, say, 0 and 10, and implementing the compression function so that every hash code is transformed to some value between 0 and 10 only. The compression function must be able to map to all of these indices, otherwise, some buckets will stay empty.
Modulo is typically used because it is easy to use, always guarantees a valid index, and works well.