Is the set {a,b} uniquely defined? First answer to this question would be yes, but consider the following question: How many elements has the set $\{a,\, b\}$? The answer to this question depends on $a$ and $b$:


*

*If $a=b$, then $\{a,\, b\}$ is a singleton.

*If $a\neq b$, then $\{a,\, b\}$ has two elements.


So is $\{a,\, b\}$ uniquely defined although its cardinality is not unique? I have two possible answers solving this problem:
Solution 1: Because of the axiom of extensionality a set is uniquely defined, iff one can say for each object whether it is element of the set or not. So $\{a,\, b\}$ is uniquely defined because one can say that an object $x$ is element of $\{a,\, b\}$, iff $x=a$ or $x=b$. The uniqueness of a set does not imply the uniqueness of its cardinality.
Solution 2: If $a$ and $b$ are in the context defined objects (which do not depend on free variables), then $\{a,\, b\}$ as well as its cardinality is uniquely defined. If $a$ and $b$ are free variables or depend on free variables, then asking for the cardinality of $\{a,\, b\}$ is the same as asking for the truth of a statement form $A(x)$ with a free variable $x$: It doesn't make sense. Just after substituting all free variables with uniquely defined objects, on can ask for the cardinality of $\{a,\, b\}$.
Which of my solutions is right or is there a better solution? What is the right answer to someone who says that the set $\{a,b\}$ is not unique?
 A: It is true that the uniqueness of the set, meaning its well-definability, does not imply that its cardinality is unique.
To phrase that in a clearer and more accurate way, proving that a set is well-defined does not mean that we can prove its cardinality is anything in particular.
Consider the set defined as follows $\{x\in\Bbb N\mid (x=x\land\mathrm{RH})\lor(x\neq x\land\lnot\mathrm{RH})\}$. If $\mathrm{RH}$ is true, then this set is $\Bbb N$, if it is false then the set is empty. 
We can prove that this set is well-defined, because we can write this expressed in the language of set theory (albeit in a complicated way), and the axiom schema of separation tells us that this is a well-defined set. Can you prove if it's empty or not? Maybe, if you can prove the Riemann Hypothesis. (Okay, so $\rm RH$ might end up provable, if you want a real doozie, replace it in the definition by something provably unprovable like the Continuum Hypothesis, or something like that.)
The first answer is correct. Extensionality proves that either this set is a pair, or it is a singleton, but it is well-defined nonetheless.
A: In a way, you answered your own question when you said the answer depends on whether $a$ and $b$ are fixed, known quantities, or whether they are parameters which you can dial according to your whim. I would say discussing the cardinality of 
$$X_{a,b} := \{a,b\}$$ 
is a lot like discussing the cardinality of 
$$Y_r := \{ x \in \mathbb{Z} : 1 \leq x < r\}.$$
The set, and the cardinality, depends on the values of the parameters.
\begin{align*}
X_{1,2} = \{1,2\} && X_{1,\varnothing} = \{1,\varnothing\} && X_{4,4} = \{4,4\} = \{4\} 
\end{align*}
\begin{align*}
Y_5  = \{1,2,3,4\} && Y_{3.8} = \{1,2,3\} && Y_{-2} = \varnothing
\end{align*}
You could even make a case that
\begin{align*}
Y_{+\infty} = \{1,2,3,4,\ldots\} && Y_{\varnothing} = \varnothing
\end{align*}
since comparing an integer with a $+\infty$ is sometimes allowed, but it never makes sense to compare and integer to $\varnothing$. Maybe showing someone this second example where it seems more obvious that the set can have multiple cardinalities could clarify something about the first example.
