Vab= E = 20V
because I = 0 and the voltage drop across the resistances R1 and R2 is also 0.
Second circuit:
Vab = 10V (no voltage drop across R1)
Vcd= E2-E1 = 20V
Series connection of voltage sources. But the sources are connected to the contrary and voltage drop across R1 or R2 is 0 V.