This course is a class of the second kind. What you turn in for your assignments, and certainly for your exams, is to be your work and only your work. Violations of this rule are violations of the university's academic integrity policy , and you should expect them to be punished as such. Not only should you turn in only your own work, you should not share your work with anyone else. So it's dangerous to show your code to someone else.
It is not necessarily true that sharing your solution with someone else will be treated as a less serious offense than using some else's solution. 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 discussed with others, or 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 (1) document that you are doing this, and (2) 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 exactly 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. In the less serious cases, grades reduced by such sanctions will qualify as "one poor grade" in the sense of the course green sheet.
A few cases are clear. Certainly asking or paying a classmate or an outsider to do your assignment counts as academic dishonesty. Even asking a classmate or outsider in a general way how to do an assignment is dangerous. Working with someone else on your program design is generally impermissible -- program design is a skill that you are supposed to be learning, and that I am supposed to be evaulating you on.
Asking about a point in the textbook or the class notes is certainly ok. In a programming course, 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.
Do not ask a tutor to assist you with your assignment.
Asking someone else about the output that a specific algorithm is to produce for a specific input is acceptable, unless I state otherwise. However understanding when a program is producing the correct output is an important skill to learn, so I hope that you will try to check your own output yourself, before asking others about it.
Asking someone else about other behavior of an algorithm used in an assignment is permissible if the algorithm is specified as part of the assignment. Otherwise this is dangerous. Especially in upper-division classes, finding an appropriate algorithm is often an important 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 have rarely done so. 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. University-imposed sanctions could include suspension or expulsion from San Josť State University.
The official university policy on academic integrity can be found at http://www.sjsu.edu/studentconduct/docs/Academic_Integrity_Policy_S07-2.pdf.