Well, both or neither, really, because "rules" governing punctuation aren't really "rules" in the sense that rules govening nouns, verbs and adjectives are rules. Punctuation "rules" vary considerably, often from publisher to publisher, or from newspaper to newspaper. I can tell you that QUESTION MARKS and EXCLAMATION MARKS should go within quotes if they refer to the quoted material only; outside otherwise.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.