0.2 moles of NaOH were added to a solution containing 0.4 moles of a weak acid and 0.4 moles of its conjugate base. After mixing, the pH of the solution was found to be 5.24. What is the pKa of the weak acid?

weak acid = HA

conjugate base = A^-
....................HA + OH^- ==> A^- + H2O
I...................0.4......0............0.4................
add........................0.2.............................
C................-0.2....-0.2..........+0.2.............
E.................0.2........0............0.6................
pH = pKa + [log (base)/(acid)]
You know pH, (base), and (acid). Substitute and solve for pKa.
NOTE. Actually, you cannot calculate concentrations of acid or base but it doesn't matter. Plugging in moles will give you the correct answer BECAUSE
(acid) = mols/L and
(base) = mols/L but L is the same for both acid and base since it is the same solution and same volume for both so L cancels and you are left with mols.