Factoring a quadratic polynomial (absolute beginner level), are both answers correct?

.Yes, you are correct. Since $(x+5)(x-2) = (x-2)(x+5) = x^2 + 3x-10$, we note that $a$ and $b$ may either take the values $(5,-2)$ or $(-2,5)$.


I would consider providing just one of the two solutions to be insufficient, since the question itself ask for the values of $a$ and $b$, but nowhere mentions that they are unique. However, any question saying "find the values of $a$ and $b$" is wrong with the word "the" : they are assuming uniqueness of $a$ and $b$, which is not the case.The question as quoted by you includes the word "the" , and this is misleading.


For commutative property of product we have that

$$(x + 5)(x - 2)=(x - 2)(x + 5)$$

note that also

$$(-x + 2)(-x - 5)$$

is a correct factorization.