Answer: B
Using the Inclusion-Exclusion principle: The number of surjective mappings = Total no of mappings – mappings that are not surjective.
$Total – (\overline{1} \cup \overline{2})$. Here $\overline{x}$ denotes that $x$ is an element of co-domain which has no pre-image.
$= 2^{10} – (\mid \overline{1} \mid + \mid \overline{2} \mid – \mid \overline{1} \cap \overline{2} \mid)$.
If I don’t use the element $1$ of co-domain there is exactly $1^{10}$ mapping possible, i.e. all elements of the domain maps to element $2$ of the co-domain. Same goes for not using the element $2$. In $\overline{1} \cap \overline{2}$ there are zero mapping because we don’t have any element in the co-domain to map to. So,
$= 1024-(1+1+0) = 1022.$