Given that, the side of square is 30cm and xcm squares are cut off.
The required diagram is,

Now the dimensions of the cuboid formed will be
l(x)=30−2x, b(x)=30−2x and h(x)=x.
The Volume of the cuboid will be V(x)=(30−2x)2(x)
Now to get Maximum value,
⇒dxdV(x)=0
⇒2(30−2x)(−2)x+(30−2x)2(1)=0
⇒(30−2x)(−4x+30−2x)=0
On simplifying we get,
⇒x=15cm,5cm
But x cannot be 15cm as the volume becomes zero.
Hence x=5cm.
Now to find the surface area of the cuboid,

Surface area will be =(30−2x)×x×4+(30−2x)2
=(30−2×5)×5×4+(30−2×5)2
=800cm2.
Therefore, the required surface area will be 800cm2.