Official Explanation
Each square shares at least one side with another square. That means all of the squares have the same side length. Segment AB would pass through two of the squares, creating two isosceles right triangles in each square. Since each square is the same size, the hypotenuse of each of those triangles would be \(8\frac{\sqrt{2}}{2} = 4\sqrt{2}\) units.
Recall that with isosceles right triangles, the ratio of the side lengths is \(x:x:x\sqrt{2}\), with \(x\sqrt{2}\) representing the hypotenuse. That means the actual hypotenuse of \(4\sqrt{2}\) corresponds to \(x\sqrt{2}\), and x, representing one side of a square, is 4. There are 10 sides around the perimeter of the figure, so the entire figure has a perimeter of 10 × 4 = 40 units. (C) is the correct answer.
Answer: C