about referencing of exercises?
To your specific question: I would not worry about referencing questions on an exam.  Although exams could end up on the Internet if a students posts them, I find it hard to believe that "fair use" does not cover using the questions for internal educational purposes, and referencing the questions is almost certainly not necessary.  That said, I am not a lawyer.

The bigger question might be 


  How does one come up with good test questions?


It used to be (and may still be) that fraternities kept a filing cabinet full of course exams used in a class from year to year, purportedly simply for study purposes, but also in the hope that professors would re-use questions from year to year and this would provide a huge advantage to those studying from the prior exams.  These days, it would be trivial to have a web page dedicated to scanned copies of old exams.  Therefore, I would advise against re-using too many questions on an exam, or at the very least modify old questions to make it difficult to simply re-apply the exact same methodology to solve.

Crafting good questions is always challenging, but some would argue that it is fun developing questions that test the students ability to problem-solve in a format that works on a timed exam.  Questions that have a single answer are easier to grade, but could limit the ability for a student to think outside the box, or to solve using alternate methods.  Depending on the subject, this isn't always possible, either.

I am of the opinion that the best tests have many different types of questions, so students can show their own strengths in different ways.  For programming tests, there might be a few questions asking students to describe what blocks of code do, others that ask the student to find syntax errors, others that ask for algorithm deficiencies, still others that ask the students to draft short snippets of code, and finally some questions that demonstrate that the student knows when to use certain constructs (e.g., when is a "do while" loop appropriate, and when is a "for" loop appropriate?  How could you turn the following "do while" loop into a "for" loop?).

As a bottom line answer to your question: I would not worry about referencing the questions on the exams, but if you are worried about students cheating by looking up the references for future exams, it is probably worth trying to obfuscate the questions themselves, or to at least change them enough that studying the questions directly from the references will not give an unfair advantage to the students that do find them.