I have often been asked two types of questions that are, in most cases, illegal to ask:
1. Age-based
2. Family-based (specifically, about kids)
In short, I inform the interviewer politely that the question they asked is not legal to ask in an interview. Most people know this. Some small businesses do not -- my experience is that they seem to feel they are exempt from these rules. And, yes, these are illegal questions because they can be used to selectively hire -- which is discrimination. They have nothing to do with one's skills and everything to do with judging if a person can be worked overtime or if the interviewer determines they are "too old" for the job (i.e., set in their ways an therefore unable to learn new things -- possibly taking a position "too low" for their experience/age and would soon be looking for promotion or another job -- etc.).
In general, I find people ask these questions because they want to connect with a detail in my life. For example, they see the college I went to and they want to know when I was there because a friend/acquaintance/child/friend's-child/etc went there. While that isn't always an age indicator, it can be, and I think it is in most cases. This is why your graduation date should not be on your resume. It may be completely inaccurate to assume you graduated at 22 (undergraduate), but we are good at making assumptions.
The family-based questions are usually to make small-talk. I get it. They want to chit-chat a bit to reckon personality and see if they want to work with you -- or if they'll enjoy kibitzing over lunch, in the break-room, etc. But asking martial status and whether or not you have children is illegal. It allows assumptions to be drawn, most often about work hours. (Kids == after-school commitments == juggling work and transporting urchins ... I mean kids.)
Yes, there are exceptions. But, as a general rule, you should know what questions are illegal and why employers ask them. Sometimes they are trying to draw conclusions without asking direct questions: i.e., would you be willing/able to work overtime; are you compulsive about your work; etc.