We use a question mark at the end of a question.
What is the time?
This is a question. You are asking someone the time.
Notice the question mark at the end of the sentence.
When you use a punctuation mark, you need to put a space after it. Don't use a space before the punctuation mark.