In brief, I claim that this should not be a question a student has to comtemplate... So, operationally, the answer is "no, it is not unethical, but it may be against the (unreasonable, indefensible) rules to an extent that will create fatal trouble for you..." So, no, it's not unethical, but probably often "seriously illegal", dangerously to you, though it should not be.
The points the other answers have made are "not unreasonable", but, I claim, essentially untenable. That is, if there are indeed very few tasks whose performance could be "tested", example executions will certainly exist "in the wild", whether or not a student in a specific class puts their own solution on-line. Although I'm thinking primarily about a mathematics environment, I'm well-enough acquainted with CS issues to not feel too out-of-it in thinking about such issues, as well. Indeed, the number of "stock" issues in both cases seems similar ... and small. That is, there is a greater underlying issue, that the number of reasonable, answerable questions (apart from trivial variations) is very small, and a conscientious person can merely collect "solutions", rather than think them through themself.
To my mind that is the "real issue", if it is an issue at all. That is, we might take the poverty-of-variation as a signal that pretending to keep some trivial idea secret so as to "test" on it is perverse!?!
There are two fundamentally conflicting issues: promoting understanding and scholarship, versus arranging convenient "testing" for various purposes. "Convenient testing" prefers as many secrets as possible, obviously. Promoting understanding would exactly want to explain to interested parties how to resolve issues raised... among other places ... in the "tests".
Some events that finally "got through to me" about this, some years ago, involved my colleagues firm admonishments that "approved solutions" for (graduate) Qualifying Exams should never be published, because otherwise the students would learn how to do those problems... uh... whah? :)
Ok, even if we "buy" that for a moment, one can observe that then bad "solutions" are the only ones available, so people study from bad material... ?!?!
The meta-comment is that many "educational" institutions have not-at-all figured out how to cope with the fluidity and availability of information, and, instead, try to prohibit all the obvious "new" avenues, simply to avoid change. While it is arguably true that the motivations of some students may not be the most honorable, I am absolutely not in favor of sting operations that declare them guilty of serious malfeasance by "using the internet" or "telling people what they know", and so on. That'd be perverse. Instead, things need to be reconstituted so that "keeping secrets" is not an essential part of appraising competence.
Summary: it's not at all unethical, but it may be so illegal that you must ask your local authorities. (Yet, again, while it's good to ask, it is terrible that there is an issue here...)