As the others have stated there are various possibilities here.
But specifically what does "Could you do it?" imply?
Well 'could' has three main inferences.
1 Ability in the past. So you may ask the question simply referring to the ability of your friend. So you were asking if they were physicaly or technically able.
2 Hypothetical option. If I asked you, could you come. Here it might be strange to ask a hypothetical question about a past exam, especially as you are not proposing hypothetical scenarios... eg If the exam was longer, could you have finished? (note also use of perfect aspect for past)
3 Formality. So "Could you tell me the time?" is more formal but equally as correct as "Can you tell me the time?" This use is what you are worried about, but it is irrelevant here.
So the question was fine in context 1, asking about ability in the past!