"Твой" means "your" and the dative would be "твоему".
But, I guess, what you wanted to know is the dative of "ты" - "you". In that case it's "тебе".
vam is dative/genetiv for vac
"Вам" is the dative, while "вас" is the genitive (and accusative, and prepositional). The nominative, i.e. basic form, is "вы".
I fail to see how that is an answer. I thought it should be just one pencil, so I chose карандаш
Yes, I am wondering the same. This question refers to the exercise, where you have several possibilities and a choice. I think the answers were meant for pure translation, but the original question isn't answered yet. So what is: "You need a pencil." in Russian? Unfortunately I cannot answer this, but maybe you know by the fom of "need" (вам нужны) that a plural form has to follow?
English and Russian are not my native tongues, so I don't guarantee anything. However it is my understanding that Вам is dative, hence is not the subject of the sentence. Карандаши is. If I wanted to make a comparison, I'd use "pencils are useful to you". That is not the real meaning of the sentence, but the construction of the sentence is similar. So, if I tell you "... are useful to you" and I give you the choice between "a pencil" or "pencils", you don't have a choice :) To say "you need a pencil" you would say " Вам нужен карандаш", where нужен is the masculine singular form of the verb. Hope that helps (and that I'm right)