Assume, T = telling the truth. F = telling the lie.
a) Condition: Exactly one is telling the truth.
Case 1.a: Suppose, Alice is telling the truth.
If Alice is T then John is also T. So, it's contradict with given condition.
1.b: Suppose, Alice is telling the lie.
If Alice is F then we can't say who's telling the truth.
So, Case 1 is not valid.
Case 2.a: Suppose, John is telling the truth.
If John is T then we can't say about other.
2.b: Suppose, John is telling the lie.
If John is F then A is F then C is F then D is T. So, it's satisfy given condition.
Hence, from Case 2.b we can conclude that if only Diana is telling the truth then John did it.
b) Condition: Exactly one is lying.
Case 1.a: Suppose, Alice is telling the truth.
If Alice is T then John is T then Carlos is F then Diana is T. So, it's satisfy given condition.
Hence, from Case 1.a we can conclude that if only Carlos is lying then Carlos did it.