⟩ How you should respond when you are asked an illegal question?
If you are asked an illegal interview question, you always have the option to end the interview, or refuse to answer the question(s). It may be uncomfortable to do, but you need to be comfortable working at the company, and if the questions you are being asked during the interview are indicative of the company's policies, you may be better off finding out now.
Sometimes an interviewer will ask inappropriate questions accidentally, and in that case, you may choose to answer them politely, avoiding the substance of the question, but addressing the intent.