What shall we do, Fred? asked Tim.
Here's why:
* Comma after "do": This separates the direct question from the speaker's name.
* Question mark after "Fred": This indicates the end of the direct question.
* Comma after "Fred": This separates the speaker's name from the rest of the sentence.
* Period at the end: This signals the end of the sentence.