The reason why doctors make you cough when holding your balls is to check for an inguinal hernia.
An inguinal hernia is where part of your intestine pushes through a weakness in the abdominal wall and into your scrotum.
When you cough, the pressure in your abdomen also increases and can make the inguinal hernia more noticeable.
By palpating your scrotum or holding your balls while you cough, the doctor can feel for any bulges or a mass which can indicate an inguinal hernia.
The doctor also asks you to turn your head so that you don't cough directly into the doctor's face.
An inguinal hernia occurs when part of your intestine or bowel pushes through any weak spot in your abdominal wall near your groin area and into your scrotum.
And if an inguinal hernia is detected, it often will require surgery to fix and repair and prevent any complications.
Doctors may need to examine and touch your private parts and private areas during a physical exam, although they can only do so with your consent and if it's needed medically and as routine exam and they should explain to you why they are doing so and will stop if you're uncomfortable.
If you're uncomfortable with the doctor touching your private area you can tell them you're uncomfortable with it and they should stop if they are a good doctor.