Another great question, and a source of much frustration for me when I see it done wrong in published work! Thanks, Melissa.
If the the dialogue is a question, the question mark goes inside the quotes: "Why are you doing this to me?" or "Why are you doing this to me?" she asked.
Let's try to separate those four.
#1. He asked. (He asked what? Incomplete thought=dialogue tag.)
#2. She slammed the door so hard the walls shook. (Complete sentence.)
#3. He said to no one in particular. (He said what? Incomplete thought=dialogue tag.)
#4. With one last scathing look at the house, Carrie stalked to the waiting cab. (Complete sentence.)
Hope this helps! If not, feel free to email me at email@example.com for additional clarification!