Although it's acceptable to use contractions in this manner, you may want to avoid them in certain contexts of formal writing. When you say, "Musn't he do this?" the syntax breaks down to, "Must not he do this?" The syntax is awkward when we're looking at the expanded version of the sentence.
Otherwise, contractions should be fine in formal writing. As long as the ex