Short answer: homework assignments are neutral in themselves; neither appropriate or inappropriate, professional or unprofessional.
Long answer: there are basically three kinds of "homework" assignments.
- Uncompensated and unused by the company.
- Compensated and at least potentially used by the company.
- Uncompensated (or undercompensated) and used by the company.
The only kind to avoid is the last, as even if they are genuinely interviewing and not just looking for free work, they have shown themselves to be both cheap and at the very least unprofessional, if not outright dishonest.
Uncompensated and unused is just asking you to invest time in showing them that you have the required abilities, no different from asking you to come in for an interview; you will invest time in doing the work, they will invest time (possibly less, possibly more) in evaluating the work you did.
Compensated and used are known as evaluation projects, and can be beneficial for both sides. The terms should be appropriate for the work done -- i.e. if the position pays X, then you should at a minimum get X for the project, regardless of whether they use it or not. This gives you a chance to judge the kind of work they will be having you do and how they will interact with you. It gives them a chance to see what you can produce and how you work with them. Do you you ask appropriate questions, do they provide sufficient details? From the employees side, this is all good--typically evaluation projects will only be requested of serious contenders, you get paid for it. So, it's like a long interview, but you get compensated. From the employers side, it can be a bit expensive and it is difficult to come up with an appropriate project--it can't be too long, it can't be too easy or difficult, if you don't do a timed limited project you don't know if they did it in two hours or two days, if you do limit the time you don't know if they missed it by 5 minutes or two days. Typicality companies work around the downsides of this by doing regular interviews (no paid homework) for a contract to hire positions thru a recruiter or temp agency.
Uncompensated (or undercompensated) and used -- they are ripping you off. Run away.