This course is a class of the second kind. What you turn in for your programming assignments, and certainly for your exams, should be your work and only your work. Do not share your work with anyone else. Note that if you lend your disk to someone, or have another student print your assignment, or turn it in for you, you may be sharing your work with someone else even if that is not your intention. It is not necessarily the case that sharing one's code with someone else will be treated as a less serious offense than using some else's code. For one thing, if I receive two assigments that are too similar, I can't always tell who did the work.
You are of course permitted to use your textbook, your class notes, and other resources to understand the material of the course. It is certainly permissible to discuss the material of the course in a general way with other students, or with outsiders. Code provided by the instructor, the textbook, or a web site related to the textbook and maintained by its author may be incorporated into your programs. In this case, you should credit the author. Code that you wrote or that was provided to you in other classes may be incorporated into your program, provided that you document that you are doing this, and credit the author if it is not you. In general, it's a less serious offense to use and credit someone else's material in your assignment than to use it without credit.
I realize that it can be difficult to understand the line between permissible discussion of the course material and impermissible collaboration on assignments. It's certainly difficult to specify this line in advance for all possible situations. This is one reason I have used in the past a sliding scale of sanctions, ranging from a small deduction to splitting a grade between two students to giving a zero for the assignment or the course (I have never yet had to give a zero for the entire course). Grades reduced by such sanctions generally qualify as "one poor grade" in the sense of the course green sheet. Small reductions are likely to be considered not "significant" when it comes to reporting incidents to the university (see below).
A few cases are clear. Certainly asking a classmate or an outsider how to do an assignment is a bad idea. Asking about a point in the textbook or the class notes is certainly ok. Asking about the programming language, program libraries, or the programming environment (e.g., the debugger) is ok as long as classwork is not shared in the process. Asking me about the assignment is ok, although I may decide that it is wisest not to answer your question completely. In other cases, it's safest to err on the side of caution.
Asking someone else about the algorithm to be used in an assignment is dangerous. In many cases, finding an appropriate algorithm is part of the assignment.
I am obligated to report significant incidents of academic dishonesty to the office of the Vice-President for Student Affairs. The reason is to allow the university to identify repeat offenders. I am not required to recommend any sanctions at the university level, and in the past I generally have not. If I do not, and if you have not been reported to Student Affairs before, then probably nothing will happen at the university level. If you have been reported before, then the matter is out of my hands.
The official university policy on academic dishonesty may be found in the 2000-2002 catalog, pp. 430-431, or at http://info.sjsu.edu/web-dbgen/catnarr/policies/n30.html