With regard to the home loan, they will usually write off the balance. It's what's known as a short sale. They will not come after you for the difference.
A car loan is different, they sometimes will, but not always come after you for the difference. It often depends on the amount. Many times the difference is less than what it would cost to sue you.