(b) Work done = final PE. - initial PE.
= `mg (1//2) - 0 = mgl//2`
(as when the rod is standing on one end, its centre of gravity is at a distance `1//2` from the table and when it is lying on the table, its CG is on the table, i.e., at zero distance from the table)