No, your answer is incorrect.
Upon heating or cooling, the linear dimensions of a uniform object like an iron rod, will change by a fixed percentage (related to the material's linear expansion coefficient). As rod B was longer to begin with, it will contract more than rod A on cooling.