How does the phrase studying grammar function in sentence 4?

Sentence 4: I hated studying grammar when I was in school.

A) main verb
Eliminate
B) direct object
C) subject complement
D) subject of the sentence.
subject

My answer: D

The answer to the question above, is wrong. 'studying grammar" this phrase functions as a direct object in the following sentence:

I hated studying grammar when I was in school.
The correct answer is
B. Direct Object

Its direct object

I(S) hated(V) studying grammar(O) in school(I).

P.S. This is not a guess. I am typing this out for my benefit so I can see it instead of imagining it.

I don't know. Would it be a main verb?

Hello Like I'd Tell You,

I would give you applause if that wasn't 6 Years Ago. Writeacher may have been trying to help, but the way they said, "Don't post about this again," was very harsh. You will need to post about it again if you need help. "Studying grammar" is a Direct Object. ^^

See ya,
Shush. I'm a bush!

The word "I" is the subject of the sentence.

Knowing that, what is "studying grammar" doing in that sentence?

No, that's your second guess. Don't post about this again.

Study the following link for normal word order in English sentences, and you should be able to figure this out.

http://esl.fis.edu/grammar/rules/order.htm