A. The answer was learnt by the student by heart.
B. The answer is learnt by heart by the student.
C. The answer by the student was learnt by heart.
D. The answer has been learnt by heart by the student.
✅ The correct answer is option D.