What part of speech is "why" in the following example?
Solution 1:
Point to consider: Parts of Speech in English are fluid and depend upon context and function in real language situations. "Why" is most often used as an Object of a verb, as in "She wondered WHY," (what she wondered), not as the verb's adverb, as in "Why did she wonder?"
But, just to mess things up a little more, consider this: "why" can inarguably replace a noun, a noun phrase, clause or more, so it can also therefore be used as a pronoun, ("She knew [what did she know?] -she knew why."]
What's worse for those old fossilized grammar school pedants is that "Why" can even be considered a relative pronoun, (perish the thought!). Quirk & Greenbaum: A University Grammar of English chapter 13, section 7 notes that 3 of those nasty "wh" pronouns can function as relative pros. For example, in the sentence, "The man walked to the place 'where' the shooting occurred," Where acts as a relative answering 'which' "place" – WHERE the shooting occurred"!