How to check if a vegetable is bitter without eating it
For cucumbers in particular, it's quite interesting.
Commercial growers use F1 hybrid varieties that produce only female flowers, and grow them in green houses or polytunnels, or under netting.
The reason for this is that in many cucumber varieties, the fruit from pollinated flowers is bitter; from unpollinated flowers it isn't. Picking reasonably early and ensuring even watering also helps.
When growing traditional and outdoor varieties you can remove the male flowers (identifiable by the stalk behind them) to avoid pollination, or buy all-female F1 varieties - but neither approach will help if there are male flowers growing nearby.