When you post a question with its answer, it may appear to users that you are just trying to 'show off' or just wanna get some up votes.
Yeah... You can pretty much consider immediate self-answered questions as the ultimate FGITW.
Of course, FGITW is generally considered a good thing, even if it does piss off the folks who get hung up on the "game" aspect of it all. In my opinion, the "self-answering rep-whore" is just as much a non-issue as the "gun slinger rep-whore" - a caricature that folks trot out when they can't be bothered to come up with legitimate criticisms.
On that note, here are some legit criticisms to go with your examples:
Not only is this spam, this type of question is explicitly discouraged thrice over in the faq:
You should only ask practical, answerable questions based on actual problems that you face.
...
...avoid asking subjective questions where …
- every answer is equally valid: “What’s your favorite ______?”
- your answer is provided along with the question, and you expect more answers: “I use ______ for ______, what do you use?”
See #1
This is actually a good question, but it's phrased very, very poorly. X is your objective here, lead with that. Let's say X is a waffle maker (all the best IDEs make waffles now) - you'd ask:
How can I make waffles in Eclipse?
... and then answer that. Say X is adding a list of numbers - you'd ask:
How can I add a list of numbers using jQuery?
... and then answer that. This may seem like a small difference from your wording, but it's important: there may well be ways to make waffles or add numbers that, while not an intrinsic feature of the tool, can still solve the same problem. As animuson notes, it's a good idea to ask questions (whether or not you intend to self-answer them) in a way that doesn't encourage a simple yes or no answer.
Note that in all three of these cases - and in nearly every other case I can imagine - moderating self-answered questions follows the exact same pattern as moderating any other question or answer. Spam is still spam if someone else asks the question, there are always multiple ways to ask the same question, and a bad answer can make even a good question worthless (while a good answer can justify keeping a lousy question, albeit with some edits).
The only exception I can think of where self-answered questions should be treated differently would be in the case of a straight-up wiki such as those that make up the community faq here on MSO. The goal here is to have a single comprehensive answer - so if the answer is incomplete or flat-out wrong, you should fix it rather than posting a competitor to it, even if that means re-writing the entire answer from the ground up. These are fairly rare though.