Let $X_n$ be a random variable sequence defined as below
$$ P(X_n=x_n)= \begin{cases} 1-\left(\dfrac{1}{2}\right)^n&\text{for }x_n=0 \\ \left(\dfrac{1}{2}\right)^n&\text{for }x_n=1 \end{cases} $$ for $n=1,2,3,\ldots$.
(a) Show that $X_n$ almost sure converges. (b) Show that $X_n$ mean square converges.
(a) $$ \lim\limits_{n\to\infty} P(X_n=0) =\lim\limits_{n\to\infty}\left( 1-\left(\dfrac{1}{2}\right)^n\right) = 1-0 = 1. $$ $$ \lim\limits_{n\to\infty} P(X_n=1) =\lim\limits_{n\to\infty}\left(\dfrac{1}{2}\right)^n= 0. $$
So, I conclude that $X_n=0$ is almost sure convergent, but $X_n=1$ is not almost sure convergent.
Is it true? Please check my answer.
(b) $$ \lim\limits_{n\to\infty} E\left((X_n-X)^2\right) = \lim\limits_{n\to\infty} E\left(X_n^2-2X_nX+X^2\right) = \lim\limits_{n\to\infty} E\left(X_n^2)-2E(X_nX)+E(X^2)\right). $$ I know how to check mean square convergence, is $$\lim\limits_{n\to\infty} E\left((X_n-X)^2\right)=0.$$ Now, I confuse about $E(X)$. How to find $E(X)$?
I guess you are a beginner in this topic, so I'll write my answer as clearly as possible. You must have missed something during your study about the convergence of random variables. The terms in my answer are based on this Wikipieda page.
For (a), what you proved is that $X_n$ converges to $0$ in probability. But your "conclusion" I conclude that $X_n=0$ is almost sure convergent, but $X_n=1$ is not almost sure convergent does not make any sense. Think carefully about that.
Now I move to the proof of your problem.
(a) Since $$\sum_{n=1}^\infty P(|X_n|>0)=\sum_{n=1}^\infty \left(\frac12\right)^n<\infty,$$ we know that $P(\limsup_{n\to\infty}\{|X_n|>0\})=0$ by Borel-Cantelli lemma. This implies that $P(\text{events }\{|X_n|>0\} \text{ take place only for finitely many times})=1,$ which means that $X_n$ converges to $0$ almost surely.
(b) In this case $X=0$ so $E((X_n-X)^2)=E(X_n^2)=(\frac12)^n\to 0$. Therefore $X_n$ converges to $0$ in mean square.