Step 1: Use the condition for rank \(2\).
Since the matrix has rank \(2\), all \(3 \times 3\) minors must be zero.
Consider the minor formed by the first three columns:
\[
\begin{vmatrix}
1 & 2 & 1 \\
-1 & 2 & 3 \\
0 & 1 & k
\end{vmatrix}
=0
\]
Step 2: Evaluate the determinant.
Expanding along the first row:
\[
1(2k-3)-2(-k-0)+1(-1-0)=0
\]
\[
2k-3+2k-1=0
\]
\[
4k-4=0
\]
\[
k=1
\]
Step 3: Check which quadratic equation has \(k=1\) as a root.
For option (2):
\[
x^2+x-2=0
\]
Substitute \(x=1\):
\[
1^2+1-2=0
\]
\[
1+1-2=0
\]
\[
0=0
\]
Hence, \(x=1\) is a root of
\[
x^2+x-2=0
\]
Step 4: Final conclusion.
Therefore, \(k\) is a root of
\[
\boxed{x^2+x-2=0}
\]