Whats wrong with this proof? (trying to prove a function is surjective) Let $f : A → B$ and $g : A' → B'$ be functions that are onto, and $h : A × A' → B × B'$
be the function $h(x, y) = (f(x), g(y))$.

Part1. Dr. Bob tries to prove that $h$ is onto with the following argument. Let
$A = B = \{1, 2\}$, $A' = B' = \{a, b\}$, $f$ be given by $f(1) = 2$ and $f(2) = 1$, and $g$ be
given by $g(a) = a$ and $g(b) = b$. Then clearly $h$ is onto, because $h(2, a) = (1, a)$,
$h(1, a) = (2, a)$, $h(2, b) = (1, b)$, and $h(1, b) = (2, b)$. What is wrong with Dr. Bob’s
proof?

I can't figure out what is wrong, bob has the outputs for $h$ as $(1,a)$, $(2,a)$, $(1,b)$, and $(2,b)$. Isn't that every element that is possible for the output? Isn't that enough to make it onto?

The second part of this problem is to correctly prove that $h$ is onto, but my proof would like bob's proof, which is incorrect.
What if $A, B$ are different sets than $\{1, 2\}$? What if $A = \mathbb{Q}$ and $B = \mathbb{N}$?

You can't proof a general statement by specializing to a convenient case.
You need to get back to basics and definition. 

Take $\forall z\in A'\times B'$, $z=(z_x,z_y)$, with $z_x\in A'$ and $z_y\in B'$.

Since $z_x\in A'$, $\exists x\in A$ such that $f(x)=z_x$ (by definition of $f$)

Similarly $\exists y\in B$ such that $g(y)=z_y$

Thus

$\forall z=(z_x,z_y)\in A' \times B'$,  $\exists (x,y)\in A \times B$ such that $h(x,y)=(f(x),g(y))=(z_x,z_y)$