First, calculate `p.d`. Across each capacitor
`V_(1)=(c)/((C+3C))V=(V)/(4),V_(2)=V-V_(1)=(3V)/(4)`
switch is in position `1`
Switch is in position `2`
The polarity of plates of middle capacitor changes while that of other capacitors remain same when switch `S` is shifted from position `1` to position `2`.
Heat developed:
`H=(1)/(2)C((3V)/(4)-(V)/(4))^(2)+(1)/(2)xx2C((V)/(4)+(V)/(4))^(2)`
`+(1)/(2)C((V)/(4)-(3V)/(4))^(2)`
`=(CV^(2))/(2)`