A US police officer has been shot and killed on her first day at work, the day after she was sworn in.