Is “What are you talking about?” grammatically correct?

Is “What are you talking about?” grammatically correct? I was restarting the Big Bang Theory, and they were talking about how Leonard ends sentences with prepositions—also, is that really grammatically incorrect too?—and Leonard goes, “what are you talking about?” And the person replies, “that.”

So really here I have three main questions

-Is ending sentences with prepositions okay? -Is “What are you talking about” an example -And thus, Is “What are you talking about” grammatically correct?