You may work together on homework problems subject to the following caveats. Working with others is one of the best ways to learn the material, and even if you understand it, it often helps you to understand it better if you try to explain it to others. If you work together on homework that is turned in, however, you must cite the other students who were involved, and make a brief explanation of the roles each student played in the process.
When you do work together, you should each write up your own solutions independently. That does not mean that you should both simply copy out the same thing; rather, it means that you can work together to develop ideas, but should organize and present those ideas independently. You should not work out every detail together; that is, when you have finished working with someone, there should still be some coordination left for you. If your papers look substantially the same at the end, you have worked together too closely.
To make this effective, I have the following rule about working with others: you may not take any written material away from a collaboration. You can write down all you want when you are together, but you must throw it all away before you separate. This will encourage you to rethink the material when you write it up. If the collaboration was successful (and you learned something from it), you should be able to reproduce those ideas on your own. If not, then you have not really learned from the collaboration, and should not receive credit for work that you don't actually understand well enough to describe independently.
In terms of programming, I expect you to complete your programs on your own, not as a group. You can discuss the algorithms and approaches to implementing them, but your final program should be written on your own, and you should be sure to cite any influences that your classmates have had on your programs.
The college takes plagiarism very seriously, and so do I. You should be sure to read the material on plagiarism and academic honesty that you received in your freshman orientation package.
Please read the comments on collaboration from my advice pages.