Admittedly my degree wasn't a comp sci but a design degree, but when we did the programming half of it students were encouraged to use others' code on the condition that it was properly attributed. It was strongly suggested to add our own comments to demonstrate understanding of what was happening.