Or maybe he is just attempting to see if the other people he is sworn to protect are still safe...it is precisely this type of attitude you are pontificating that makes LE's job difficult.
Absolutely you can respond with "Am I being detained?" or "Am I free to go?" but why would you? If you're on the straight and narrow why not just answer the officer's questions and make his job easier? Why go out of your way to be difficult?
If I am a law abiding citizen why should I subject myself to an unlawful search? To ensure others are still safe isn't a good enough reason for me.