You are correct: I would not be appropriate to cough or clear a throat during a Western classical vocal performance. It is for this reason that many vocalists will carry water out with them and will drink during a break between movements or while resting.
If a vocalist absolutely must cough, it is excusable to cough between movements or songs during a performance of a song cycle, however, the vocalist should take care to turn from the audience, cover their mouth with their elbow, and immediately follow the cough with a drink of water. Running off the stage is not advisable, and it would certainly make the pianist feel very awkward.
That said, sometimes things happen: people cough, cell phones ring, vocalists forget words, instruments break, strings break, mouthpieces fall out, mutes fall out. Things happen. The trick in performing is to minimize as much as possible. If it's not possible, stop, and resume from an appropriate place.
Regarding an exam / competition, it would be best to do any coughing prior/post the exam. Take water, take tea, eat a banana, do a salt gargle; anything to minimize possible tickling before you enter. Even bring water with you if absolutely necessary. If you cough during a performance, you will lose points. If you absolutely must clear your throat before you sing, turn from the judges, muffle your mouth with your elbow, clear your throat, and then proceed.
Hope that helps.