Let $A$ be the space :
$A = \{(x,y)\in R^2:x \in Q\text{ or }y \in Q\}$
equipped with the subspace topology for the standard metric topology on $R^2$.
$(a)$ Show that $A$ is connected.
$(b)$ Show that the intersection of $A$ and $S^1$ is not connected.
Let $f:A\rightarrow \{0,1\}$ be a continuous function such that $f(0,0)=0$, since $r\times \mathbb{R}$ is connected, for $r\in\mathbb{Q}$, $f(r\times \mathbb{R})=f(r,0)$. You also have $f(\mathbb{R}\times \{0\})=f(0,0)$. This implies that $f(r\times\mathbb{R})=f(r,0)=f(0,0)$. A similar argument shows that $f(\mathbb{R}\times\{r\})=f(0,0)$. This implies that $f$ is constant and $A$ is connected.
To show that $A\cap S^1$ is connected, consider the points $p=(cos(\pi/4),(sin(\pi/4)); q=(-cos(\pi/4),sin(\pi/4))\in \mathbb{R}^2-A\cap S^1$ and the line $l$ throught $p$ and $q$, $\mathbb{R}^2-l$ has two connected components $U,V$ and $U\cap A\cap S^1$ and $V\cap A\cap S^1$ are not empty. Since $(0,-1)$ and $(0,1)$ are elements of a distinct connected component.