Earlier quoted context omitted.
Don't know about the US but here it would be reason enough for my employer to terminate me right away. This is the default for employments. For work on the side, I need to ask my employer for permission. My employer will then be concerned that all labour protection laws will not be violated, which for example means that my employer must accept that I might not be able to work overtime for them, with a side contract,…
In terms of hours per day worked, what is the actual difference between doing an unpaid take-home test? Signing a contract is just being honest about the time it's going to take to learn about the candidate. What about onsite interviews, do you have to tell your supervisor that is the reason you are taking off work? Would they be OK with that?
So I would not do take home exams that could appear to be consulting work etc. Of it appears to be a test, it is fine(r).
Note that this is tricky for open source work too, you are doing on the side. (At least in my legislation). Contributions that are closely related to my work topics I usually ask for a permit according to company policy. For completely unrelated stuff (writing that interpreter in prolog, etc.) I assume my employer is disinterested (they really are). I cannot assume that for contract work with another company.
Anyway, a judge, given a CONTRACT with another company that was not approved has the easiest case in front of them. This is the situation I want to avoid. I wouldn't bet on a judge to dive into the details on what stuff was coded in this situation.
You mention the on-site interview. This is easy. It is not a consulting or contracting gig. So I don't need to get a side-work permit, and they are treated as any of my other absences when I don't supply a reason.