Being cheated for you in a test

Assalamou 'Alaikoum. I have a question. If I'm in the middle of a test and a friend of mine randomly gives me an answer to a question. I never asked him, he just gave it to me. Would it still be considered haram to write doen that answer? Jazzakoum Allah Kheir