In a paragraph if the quote is a part of it is inside the period. so like .. While walking down the street Sam turned to me and said "I sure wish we had a car". if it is stand alone like in a conversation it is inside.. "hey Joe," "yeah, what do you want?"
If the quote is a question in a paragraph you would write it like this. While walking down the street Sam turned to me and asked "how far it is anyway?". with the ? mark inside the quotes and the period outside :)