A. Queries and synopses are different things. You would never find a synopsis in a query.
A is a one-page letter that explains what you’ve written, who you are, and why the agent should represent you. In a query letter will be a pitch, which is a explanation of your story in 3-8 sentences. It’s like the text you see on the back of a DVD box. It’s designed to pique your interest. A pitch, like the back of a book or DVD, will not spill the beans regarding the ending.
A is a front-to-back telling of what happens in your story. It’s like sitting down with a 12-year-old and explaining your entire story in about five minutes. You explain who the characters are, what the conflict is, the three acts, and finally, what happens at the end (e.g., the villain dies). So, in a synopsis, you do indeed give away the ending. You would not do so in a pitch, and a pitch is what appears in a query.