All of the questions invite "Yes/No" answers, but, as you have identified, c) and d) are not straightforward.
Questions a) and b) are neutral questions. The questioner is not placing any emphasis on whether you should answer "yes" or "no". However, in c) and d), by using this style of phraseology (as you say, a "negative question"), the questioner is actually inviting you to agree that this is indeed a pencil, and that they are cats. So, if you agree that it is a pencil, you will answer "Yes" - short for "Yes, it is a pencil", and so on.
Similarly, if you were asked "Don't you like cats?", the answer would be either "No" (short for "No, I don't like cats") or "Yes" (I do like cats). In English, if you want to confirm the negation of a negative question, you do it by using the negative particle "no". It's also called a polarity-based system. The simplest way around it is to treat the negative question as if it were a neutral question, and answer accordingly. In other words, answer the question "Don't you like cats?" as if you had been asked "Do you like cats?" However, to avoid any chance of being misunderstood, it's always best to reply to this type of question in full, eg "No, I can't stand cats!"