Another approach:
Suppose we have some metric space $(M,d)$, and a subset $M' \subset M$. Then $(M',d)$ is a metric space as well. Then a set $U' \subset M'$ is open iff there is some open $U \subset M$ such that $U'=U \cap M'$. This is fairly straightforward to prove. It is also straightforward to prove the corresponding result for closed sets.
In your examples, $M=\mathbb{R}$ with the usual metric and $M'=(-1,1]$. So, your examples can be written as:
(i) $(-1,1] = \mathbb{R} \cap M'$, so $(-1,1]$ is both open and closed in $Y$.
(ii) Needs a little more attention. If $(-\frac{1}{2}, 0] = U \cap M'$, where $U$ is open in $\mathbb{R}$, then we would also have $(-\epsilon,\epsilon) \subset (-\frac{1}{2}, 0]$ for some $\epsilon>0$, so it cannot be open. Similarly, if $(-\frac{1}{2}, 0] = C \cap M'$, where $C$ is closed in $\mathbb{R}$, then we would also have $\frac{1}{2} \in (-\frac{1}{2}, 0]$, so it cannot be closed.
(iii) $(-1,0] = (-\infty,0] \cap M'$, so $(-1,0]$ is closed in $M'$, and the same line of reasoning for (ii) shows that it cannot be open in $M'$.
In fact, every subset of a metric space is the union of closed sets.
Hint: In a metric space singleton sets $\{x\}$ are closed.
Best Answer
Metric spaces that aren't connected can give such examples. For example, $(0, 1) \cup (2, 3)$ is a metric space (equipped with the usual Euclidean metric) and both $(0, 1)$ and $(2, 3)$ are open and closed in the topology induced by the metric.
Of course, as usual $\emptyset$ and the entire space are two more examples, for a total of four.