Yes, your answer does appear to be correct, although it would have been helpful to show a bit more working, or quoting the theorem about the sum of the squares.
The person setting the question may not know the answer and may need help in finding out how to get it. The Best Answers are those with a good explanation as well as the right answer.
Here's my way of working it out:
Plot a rectangle A(0,0), B(0,a), C(b,a), D(b,0) where a and b are the lengths of the sides of a rectangle. Point Q(x,y) is anywhere in the rectangle.
AQ=sqrt(x^2+y^2); BQ=sqrt(x^2+(a-y)^2); CQ=sqrt((b-x)^2+(a-y)^2); DQ=sqrt((b-x)^2+y^2).
AQ^2+CQ^2=x^2+y^2 + (b-x)^2+(a-y)^2;
BQ^2+DQ^2=x^2+(a-y)^2 + (b-x)^2+y^2.
So for all points Q in a rectangle ABCD AQ^2+CQ^2=BQ^2+DQ^2, just as you stated! 9+25=16+QD^2 and QD=sqrt(34-16)=sqrt(18)=3sqrt(2).