We are asked to determine which of the triangles is a right triangle. To do that we can apply the Pythagorean theorem, taking the larger side as the hypotenuse. If the Equality of the Pythagorean theorem holds, then the triangle is a right triangle.
Let's take triangle P. The largest side is 30, therefore, we take this as the hypotenuse. The Pythagorean theorem is as follows:

Where:

Now we substitute the values:

Now we solve the squares:

Adding the terms:

Since the terms on the right side and the left side are not equal, this means that the given triangle is not a right triangle.
Now, let's do the same procedure for triangle Q. We have that the hypotenuse in this triangle is 41. Therefore, substituting in the Pythagorean theorem we get:

Solving the square:

Adding the terms:

Since we got the same result on both sides this means that the triangle Q is a right triangle.