If a character asks a question, does the question mark go inside or outside the quotation mark?

In dialogue, treat question marks the same way you treat other punctuation marks; put them inside the quotation marks.

“When are you leaving?" he asked.
“Will you take care of this mail?" Liam held out the stack of envelopes.

Notice the tag in the first example. The “h" in “he asked" is not capitalized. This might look odd. After all, we're trained to capitalize after a question mark. However, when you use a tag, that tag is part of the larger sentence that includes the dialogue. Usually they are joined with a comma:

“We're leaving," he said.

Since the dialogue is a question, though, the question mark is necessary, but the tag is still part of the sentence. It may look odd, but this is the convention.

In rare instances, a question mark applies to a whole sentence of which the quotation is a part. In such instances, the question mark would go outside the quotation marks:

Does Phil always yell, “Save yourself"?

This isn't common in fiction, but it's an exception worth knowing.