First of all, civilians ask impertinent questions of officers all the time. While there may sometimes be legal or other constraints that prohibit them from going into detail, most will at least give a simple reply to let the person know they are being heard. I really don’t see why it should be any different when the officer is the one asking a harmless question.
However, if an officer asks what you feel to be an inappropriate question, you should stay calm and speak frankly but politely by saying “I’m sorry, but I don’t have time to talk right now.” Most officers will tell you to have a good day and drive away. If the officer persists with unwanted questions then you should ask “Am I being detained?” Again, while most officers will likely give an unambiguous answer to this, a few may continue with their questions without answering yours. At that point, you should simply say “Well, I’ll be leaving now if I’m not being detained.” When you turn to walk away, you will know for certain whether you are being detained.
Keep in mind that abrupt reactions to being questioned by an officer (such as immediately running away) may actually serve as a legal pretext for being detained.