question mark and exclamation point with quotation marks

Whether the mark belongs to the quoted words or to the sentence around them.

If the quoted words are the question or the exclamation, put the mark inside. If the sentence around the quotation is the question or the exclamation, put the mark outside. He asked, “Is the gate shut?” Did she say “shut”?

Examples

UseShe yelled, “Fire!”

UseWho shouted “fire”?

AvoidShe yelled, “Fire”!

AvoidWho shouted “fire?”