Marks given for each wrong answer = ( -1 )
Marks obtained by 12 correct questions = 12 × 2 = 24
Marks obtained by student = 21
So, total negative marks = 24 - 21 = 3
So,the total number of incorrect questions = 3÷1 = 3
Total number of questions he attempted= Number of correct questions + number of incorrect question
= 12 + 3 = 15
So, the total number of questions the student attempted is 15.