Can anyone please tell me that when do we prefer multimap over map?
You'd use a multimap when you want to allow the same key values in your map.