Negative questions

I'm quite confused as to where to put the affix "ler" in negative questions. One of my textbooks says: "Onlar genç değil mi(dirler)?" According to another, it should be: "Zengin değiller mi?" Does it depend on whether we're talking about animate or inanimate objects or is there no difference?

Are you having a trouble about where to put it or whether or not you should put it? I'm asking because you put the first one in parentheses.

If it is where you're curious about, you can say: Onlar genç değiller mi? or if you have the -dir: Onlar genç değil midirler? However, this second one doesn't mean the same thing, as you have a -dir.

If you want to know whether or not the -ler is used, the grammar says that you should always use it as long as the subject is a humanbeing, otherwise it shouldn't be used. However, in real life, things are different. The tendency is that, so long as you have the pronoun onlar present in your sentence, you can forget about -ler, as the meaning is clear. If onlar is hidden, we use -ler to differentiate it from the third person singular.

The parentheses in the first sentence is how it is written in my textbook. They mean to say that the "-dirler" part can be omitted. Actually I'm confused about where the "-ler" affix should go. If both "Onlar genç değiller mi?" and "Onlar genç değil midirler?" are possible, but as you say they don't mean the same, what's the difference then? Don't they both mean "Aren't they young?"

Rather a slight difference, değil mi? I can't for the life of me get the feel of it. Do you think it would be much of an error to assume the two sentences are almost the same? For a beginner, at least.

For a beginner, of course.
A lot of learners make mistakes in using -dir, aorist tense and the -miş. And from what I've noticed, a few minutes into the conversation, native speakers start seeing these 'error patterns' and the initial confusion disappears. So don't sweat too much at this stage.

Apart from the uncertainty meaning Rallino mentioned, -midir can also be used to add a more formal (and somewhat outdated) tone to the question, which is sometimes used in cases where the question is directed at a (large) group of people. I think your "genç değil midirler" example sounds more like it has this second meaning (I am not sure, but I think this might even be the original meaning of -dir inside a question; because "-dir" is a suffix that indicates certainty rather than uncertainty. The uncertainty meaning must have developed afterwards in colloquial speech).

If the -dir is used with this meaning, the slight difference between the two sentences becomes as below:

But this usage is pretty rare, so maybe it's best to forget about it.
Oh, and the sentence I tagged as 'informal' is just informal compared to the -midir version below it. It can actually be used in formal environments.