Police are out every day dealing regularly with people who are not the best examples of humanity, and most, I’ve found as a journalist, are decent, hardworking men and women who are intent upon making their community a safer place. I imagine that dealing with the kinds of people they deal with regularly makes them a little suspicious of anyone who is behaving in a manner outside the norm.
That said, the best you can do when encountering a police officer under these circumstances is to be polite, show respect and otherwise behave just as you did — I truly commend you for your level-headed response. He was doing his due diligence, as it were, trying to make sure in his own mind that you were not what he was afraid you might be.
If you consider it from his perspective — and assuming the officer is intent on public safety and not putting a feather in his cap — he probably feels if he’s not the best he can be, someone could get hurt if he’s not doing his job properly. Yes, he seemed a little gung-ho, but that might be chalked up to the inexperience of a young officer or the self-blame some officers put on themselves when they miss something, which is inevitable — they’re only human.
Again, I admire the way you handled this.