In addition to the answer by Swarnali Chatterjee Yokota, I use the tap test…tap with my fingers or a small metal object. The sound should be sharp and clear…
With all these Quality Control Tests, there is a small but non-zero probability of getting a bad coconut….even the shop keepers admit to that….
That is one reason I buy at least two or more coconuts when I go to the shop. I can avoid one more trip if one of them goes bad….chance of both going bad is very remote…