This sentence is a well known paraphrase of a line by psychologist William James, who said that the greatest discovery of his generation was that people can change their lives by changing their attitudes. The sentence structure needs a noun describing something learned or found out, followed by a verb that repeats the idea of change applied to attitude.
"Discovery" fits the first blank because the sentence is presenting a significant realization about human potential, something found out through observation or reflection. "Altering," meaning changing or modifying, fits the second blank perfectly because it echoes "alter his life" earlier in the sentence, keeping the meaning consistent, a person changes their life by changing their attitude.
"Gift ... gifting" makes no logical sense, a gift is not something "discovered" about a generation, and gifting an attitude is meaningless. "Misgiving ... elevating" is wrong because a misgiving means doubt or unease, which contradicts the positive, empowering tone of the sentence. "Thing ... flaunting" is too vague, and flaunting means showing off, which does not logically connect to altering one's life.
Since "discovery" and "altering" keep the sentence logical and consistent in meaning, option 2 is correct.