The Chicago Manual of Style (17th ed.), 6.69, has something to say about this.
In particular, note the first sentence and the first example sentence.
A question mark is used to mark the end of a direct but unquoted question within a sentence. This usage is no different from that of a directly quoted question . . .
Is it worth the risk? he wondered.
An indirect question never takes a question mark.
He wondered whether it was worth the risk.
How the two could be reconciled was the question on everyone’s mind.
When a question within a sentence consists of a single word, such as who, when, how, or why, a question mark may be omitted, and the word is sometimes italicized.
She asked herself why.
The question was no longer how but when.
A polite request disguised as a question does not always require a question mark. Such formulations can usually be reduced to the imperative.
Will the audience please rise.
Would you kindly respond by March 1.
Of course, style choices are just guidelines. There isn't necessarily a "right" or "wrong" way to do something, especially when it's not completely clear cut.
But based on Chicago, I'd say that the following is fine:
Why do you think this class is important for your degree? would be a better question to ask students.
I also think that your second example sentence, even if it doesn't completely following these guidelines (and I actually suspect it does), it follows enough in the spirit of them that nobody would object to the lack of a question mark.