A forum on issues of faith became another occasion for sparring by Barack Obama and Hillary Rodham Clinton.