To be strictly correct, they should be -
"You need to find out to whom she has been talking."
"Do you know to whom she has been talking?"
However, in everyday conversation your original second sentences would be more usual and would sound less formal.
Buggles (not a teacher)