The hardest part about this problem is understanding where to start. To help explain, I've added some steps. First, the shortest way to get from point A to point B is along a straight line. That means the shortest distance for AQ + BQ is when Q is on the line from A to B. So we should first find the line between A and B.
m = (y1-y2)/(x1-x2) = (4-(-2))/(-2-7) = -2/3
So
y = -2/3x + b
Solving for b using point A
y - 4 = -2/3(x + 2)
y = -2/3x + 8/3
We know that point Q lies on this line. We also know that point Q's y coordinate is 2. So, solving for x:
2 = -2/3x + 8/3
-2/3 = -2/3x
x = 1
That means that point Q is located at (1, 2).