Let two parts be $x$ and $y$ and part $x$ is used to make square and part $y$ is used to make rectangle.
$\large x + y = 340$
If $x$ part is used to make square, means it is the parameter of square and each side of square is $\frac{x}{4}$
Similarly, for rectangle $2*(l+b) = y$ and $l = 2b$
$2*3b = y \Rightarrow b = \frac{y}{6}$ and $l = \frac{y}{3}$ (we know $y = 340-x$)
Question says the combined area of the square and the rectangle is a MINIMUM
$\color{green}{A = (\frac{x}{4})^2 + \frac{340-x}{6}*\frac{340-x}{3}}$
For combined area to be minimum $\frac{\text{d}A}{\text{d}y} = 0$
$\Rightarrow \frac{2x}{16} - \frac{2(340-x)}{18} = 0$
$\large \Rightarrow x = 160$
But question asks for MINIMUM length of side of square that is $\color{maroon}{\frac{x}{4} = 40mm}$
Correct Answer: $B$