As an interviewer how would you prove during a trial that by asking these kind of questions you were not intending to discriminate the interviewee?
Don't get me wrong, it is a very bad idea to ask these questions. But it is not illegal, strictly speaking.