Many people make a mistake when they think about ethics: they believe ethics is a simple rule system for evaluating what is right and wrong in any given context, when ethics is actually a system of reasoning about questions that can be applied to different contexts. For instance, in your example you start by asserting that this is a question of self-interest vs altruism, but have you really reflected on that presumption?
If I started reasoning about this question ethically I'd note that your presumption rests on the idea that a grade has an intrinsic value of its own — if you have a higher grade it improves your standing and marketability — but helping others also has an intrinsic value. You might decide that it's good to help your friend if he's on the verge of flunking out (when he is no threat to your standing), but not if he's getting a decent grade already. But then I'd go deeper, and think about how a grade is actually a reflection of a different value — actual knowledge — and that helping your friend get a better grade comes at the expense your friend actually achieving that knowledge. In that sense, your friend's request amounts to a kind of self-harm, because he is depriving himself of the knowledge that is being tested and leaning on you to cover that deficit. Further, what happens because he hasn't learned that knowledge? If he goes on to become a engineer or architect, but lacks the knowledge that exam was testing for, would the buildings he designs or constructs have fatal weaknesses that lead them to collapse? One of the purposes of exams is to weed out people who lack the knowledge necessary to work in a field. Is it ethical to help him pass into incompetence?
As I said, there's no cookie-cutter right/wrong answers to these questions, but the point is to lay out the various personal and social values that come into play so that you can weigh them properly against each other.