Answer: there were 20 questions in the exam.
Explanation:
Let x represent the number of right answers.
Let y represent the number of wrong answers.
Alexandra scored 40 on an exam, receiving 3 points for each right answer and losing 1 point for each wrong answer. It means that
3x - y = 40- - - - - - - - - - 1
Had 4 points been given for each right answer and 2 points deducted for each wrong answer, Alexandra would have scored 50. It means that
4x - 2y = 50- - - - - - - - - - -2
Multiplying equation 1 by 2 and equation 2 by 1, it becomes
6x - 2y = 80
4x - 2y = 50
Subtracting both equations, it becomes
2x = 30
x = 30/2
x = 15
Substituting x = 15 into equation 1, it becomes
3 × 15 - y = 40
45 - y = 40
y = 45 - 40
y = 5
The number of questions in the exam is
x + y = 15 + 5 = 20