No, you can't swap because they're different sets of coordinates. If you have a function $f$, then $\frac{\partial f}{\partial q^i}=\sum\limits_{l=1}^n\frac{\partial f}{\partial x^l}\frac{\partial x^l}{\partial q^i}$. Applying this to the function $f=\frac{\partial q^k}{\partial x^j}$, you get $\frac{\partial}{\partial q^i}\left(\frac{\partial q^k}{\partial x^j}\right)=\sum\limits_{l=1}^n\frac{\partial^2q^k}{\partial x^l\partial x^j}\frac{\partial x^l}{\partial q^i}$.
You should think of this as having a diffeomorphism $\phi:U\to V$ where $U,V\subset\Bbb{R}^n$ are open sets (diffeomorphism means $\phi$ is smooth and $\phi^{-1}$ exists and is smooth). Then, we denote a general point in $U$ as $x$, and a general point in $V$ as $q$, so $\phi$ maps '$x$-coordinates to $q$-coordinates'. The symbol $\frac{\partial q^k}{\partial x^j}$ then denotes the $(k,j)$ entry of the Jacobian matrix $\phi'$, i.e at a point $a\in U$, the number $\frac{\partial q^k}{\partial x^j}\bigg|_a$ denotes the number which resides in the $(k,j)$-entry of the matrix $\phi'(a)$. Likewise, when we do $\frac{\partial x^l}{\partial q^i}$, it means the $(l,i)$ entry of the Jacobian matrix of the inverse map $(\phi^{-1})'$. So, the above computation can also be written as
\begin{align}
D_i\left((D_j\phi^k)\circ \phi^{-1}\right)=\sum\limits_{l=1}^n[(D_lD_j\phi^k)\circ \phi^{-1}]\cdot D_i(\phi^{-1})^l.
\end{align}
(The composition by $\phi^{-1}$ is because we have to express $D_j\phi^k\equiv\frac{\partial q^k}{\partial x^j}$ first 'as a function of $q$' so that we can apply $\frac{\partial}{\partial q^i}$ to it).
Now, regarding the exercise, where one has to show the 'cancellation of dots' property, I think it's much clearer if the problem is phrased as follows. Let $\phi:U\to V$ be a diffeomorphism as above. Now, consider the following function, $\Phi:U\times\Bbb{R}^n\to V\times\Bbb{R}^n$, defined as $\Phi(x,v)=(\phi(x), \phi'(x)\cdot v)$; here $\phi'(x)\cdot v$ means the product of the matrix $\phi'(x)$ with the column vector $v$. In classical notation, we say that we have a coordinate transformation $x\mapsto q(x)$, which induces a mapping on the space of positions and velocities (more technically called the tangent bundle), $(x,\dot{x})\mapsto (q,\dot{q})$; this is what the map $\Phi$ does.
Then, you can easily convince yourself that the Jacobian matrix of $\Phi$ has the following block structure:
\begin{align}
\Phi'(x,v)&=
\begin{pmatrix}
\phi'(x)&0_{n\times n}\\
\star & \phi'(x)
\end{pmatrix},
\end{align}
where $\star$ denotes some irrelevant (for our purposes) $n\times n$ matrix. So, the 'cancellation of dots' property corresponds to the fact that the top left block and the bottom right block are both $\phi'(x)$ (the top left is the matrix $\frac{\partial q}{\partial x}$, and the bottom right block is the matrix $\frac{\partial\dot{q}}{\partial\dot{x}}$).