Explain your side and see other's reasons.
It didn't exactly set a firm foundation for the him and Hobbitkind, and it wasn't even really a riddle, but Biblo's behavior can be excused by utter fear for his life.
Technically, no, the question was not a fair riddle under the ancient rules of the riddle game. However, Gollum accepted it with the insistence of getting three (really, four) guesses.
In other words, Gollum accepted it, therefore it was validated.
While not a true riddle, Gollum did say "ask us" (in the movie). It's been too long since I've read there book to remember the exact wording. I do think it was fair under there circumstances, Bilbo's life in danger and all.
Gollum's dialogue in the book was pretty similar to what happened in the movie.
So Gollum kind of asked for a question then.