Both versions are perfectly grammatical and natural-sounding, but they mean slightly different things. Sort of. If you want them to.
That sofa needs cleaning again.
This means that some attempt needs to be made towards cleaning the sofa. Unless it's your mother saying this to you, the implied end result is not necessarily a perfectly clean sofa. (If it is your mother, then you're usually better off assuming she wants perfect cleanliness, even if all she says is "Hmm, that sofa has been cleaner." But I digress.)
That sofa needs to be cleaned again.
Here, there is at least a slight implication that the desired end result is a clean sofa, not just a cleaner sofa.
Now, keep in mind that these are just-barely-discernible shades of meaning, not outright "use this if and only if you mean..." In practice, the intended meaning is almost always total cleanliness or a reasonable facsimile thereof.
Regarding 2a and 2b, both are possible1, but neither is what I'd say in that situation. Better alternatives:
You need to get your head examined.
You need to have your head examined.
Your head needs to be examined.
1 The version without the "to be" starts to sound a bit like the Central Pennsylvania dialect "that car needs washed" type of construction; it sounds awkward, but not necessarily wrong. But then, I live near Philadelphia, so perhaps I'm not the best judge.
In Sentence 1, the subject is Attending X (not me), and the verb is gave (not attending).
Your first sentence is an example of a sentence with a gerund phrase as a subject. Wikipedia gives these examples:
In Sentence 2, the subject is I and the verb is acquired, and attending X is a prepositional object.
In short, you can say it either way without fear of violating any grammatical rules.
I think your question title is fine – not because it’s accurate (it isn’t), but because it reveals the source of your misunderstanding.
Best Answer
In this case "quite" is used as an emphasiser, for example:
In both of these cases the sentences mean the same thing, i.e. that Jane is tall, with an extra emphasis placed on Jane's tallness.
It's use in this form is uncommon outside of British English, although even there its use is becoming increasingly rare.
Putting this together with your sentence, we can see that "quite the opposite" is merely an emphasis of "the opposite", hence the following two sentences are effectively equivalent:
Consequently in your sentences, sentence 1 and 3 are both perfectly fine either with, or without the word "quite".
Sentence 2 and 4 are not quite right. "Opposite" tends to be used comparatively, for example:
Whereas "contrary" reverses the meaning of a sentence and restates it:
Notice here that "contrary" can be combined with "quite" to give the sentence additional weight and emphasis. "Quite the contrary" is an idiomatic expression that means "No! Exactly the opposite!"
Therefore in answer to your question, "quite" is an emphasiser, and sentence 1 and 3 are correct. Sentence 2 and 4 are not correct because "contrary" cannot be used comparatively.