A police officer can stop and question you without cause and although morally you may decide to answer questions, you are not legally required to do so. If you do answer their questions this is referred to as a "consensual interview" which is a voluntary exchange between a police officer and a citizen.
As long as the police officer conducts the interview without suggesting that you are required by law to answer questions, and you feel free to end the interview and walk away at any time, the encounter is considered consensual and legal.
Reference: U.S. v. Drayton, U.S. Sup. Ct. 2002

