I have a question about the following sentence:
Is it possible to replace "か" with "のか" without misunderstanding in this sentence? Namely,
This の is called "explanatory-no". Its basic role is to provide an explanation for the current background context. When it's used with the question marker か, のか seeks clarification or explanation for the current context.
As described in the second link, の can form a casual question even without か, although in this case か is required since it's in an embedded question.
That said, in this specific case, I think both sentences are almost completely interchangeable, with or without の. Maybe the latter sounds slightly more emphatic or emotional.
On the other hand, の is almost mandatory in the following context:
This is a typical case where の is used to seek clarification.