Solution:
For 3X3 array we have in all 5 squares (when joined vertically or horizontally) such that we have 2^2 squares of side 1X1, and 1 square of size 2X2.
But when mid-points of the 2X2 square is joined, we have another square whose all vertices are on the perimeter of the array of 3X3.
Please note that both the 2X2 square have all the vertices on the perimeter of 3X3 array. Thus, in all we have 4 + 2 = 6 such squares for 3X3.
For 4X4 array we have 9 squares of size 1X1, 3 squares (whose vertices lie on the perimeter of the array) of size 3X3 and 4*2 squares of size 2x2 [4 is conventional we all know, we double it as the midpoints of the edges joining will also form an equal number of squares] => In all 9 + 8 + 3 squares.
Now for our problem in hand 5X5:
We have 16 ((n-1)^2, when array is nXn) squares of size 1X1, 4 (n-1, when array is nXn) squares (whose vertices lie on the perimeter of the array) of size 3X3, 18 squares (2*(n-2)^2 of size 2X2) and 12 squares (3*(n-3)^2 of size 3X3) [for 3X3 we have trepled as done in 4X4 logic above]
=> In all 4 + 16 + 18 + 12 = 50 squares.
=> Choice (4) is the right answer