Dynamic structure factor and momentum distribution of a trapped Bose gas