Find the Ionisation Potential and Electron affinity of X
The Ionisation Energy of an atom is defined as the minimum amount of energy required to remove the most loosely bound electron of an isolated neutral gaseous atom or molecule. In this case, since $E_1$ amount of energy is used to ionise $N_0/2$ atoms, the ionisation energy of each atom is $\frac{E_1}{N_0/2} = \frac{2E_1}{N_0}$.
The Electron Affinity is defined as the amount of energy released when an electron is attached to a neutral atom or molecule in the gaseous state to form a negative ion. In this case, $E_2$ amount of energy is released when $N_0/2$ atoms accept electrons to form negative ions, hence electron affinity of each atom is $\frac{E_2}{N_0/2} = \frac{2E_2}{N_0}$.
Your answers are correct. The textbook must have made a typo in the second question. For the textbook's answer to be correct, the second question should read

$N_0/2$  atoms of $\ce{X+_{(g)}}$ are converted into $\ce{X−_{(g)}}$ by energy $E_2$

This gives the answer as $\frac{E_2 - E_1}{N_0/2} = \frac{2(E_2 - E_1)}{N_0}$ for electron affinity.