For any closed set $A$ of $\mathbb R$ , does there exists a function $f:\mathbb R \to \mathbb R$ such that, $f$ is discontinuous exactly on $A$? For any closed set $A$ of $\mathbb R$ , does there exists a function $f:\mathbb R \to \mathbb R$ such that, $f$ is discontinuous at every point in $A$ but, is continuous at all other points ?
 A: In general, if $X$ is a topological space, $Y$ is a metric space, and $f : X \to Y$ is a function, then the set of continuity points of $f$ must be a $G_\delta$ set in $X$, meaning a countable intersection of open sets. If $Y=\mathbb{R}$ and $X$ is a metric space with no isolated points (for instance, $\mathbb{R}$) then the converse is true, i.e. for any $G_\delta$ set $A \subset X$, there exists $f : X \to \mathbb{R}$ such that the set of continuity points of $X$ is $A$. A proof of this converse is given here: http://alpha.math.uga.edu/~pete/Kim99.pdf The construction is very similar to Nescio's comment; it is based on the construction of a dense set whose complement is dense, which in $\mathbb{R}$ is naturally given by $\mathbb{Q}$.
Your result follows from this, because an open set is certainly a $G_\delta$ set.
The proof of the first result is not difficult, but it is a little bit tricky. You first introduce the set $A_n$ of "$1/n$-continuity points", i.e. the points $x$ where there exists a neighborhood $U_x$ such that if $y \in U_x$ then $d(f(x),f(y))<1/n$. Then you prove that $A_n$ is open, and that the set of continuity points of $f$ is $\bigcap_{n=1}^\infty A_n$. In a somewhat less general context, this is an exercise in Royden and Fitzpatrick.
The "dual" problem, asking whether there is a function continuous on any given closed set, has the same answer. This follows from the second result above in concert with this: A closed set in a metric space is $G_\delta$ But the trend ends here, because there are $F_\sigma$ sets such as $\mathbb{Q}$ which cannot be a set of continuity points. You can prove this by assuming that $\mathbb{Q}$ is a $G_\delta$ and then using the Baire category theorem to conclude that $\mathbb{Q} \cap \mathbb{I} = \emptyset$ is dense in $\mathbb{R}$, which is an obvious contradiction.
A: It seemed to be popular enough in the comments so, 
You can consider a function defined as $f(x)=0$ for $x\in\mathbb{R}\setminus A$ and $f(x)=1$ if $x\in\mathbb{Q}\cap{A}$ and $f(x)=2$ if $x\in\mathbb{I}\cap{A}$. It will be continuous at each point $x_0$ outside of $A$ as it will be $0$ at an environment of $x_0$ (As $\mathbb{R}\setminus A$ is open), and obviously not continuous at $A$.
A: If we take the Cantor's set C and and take its complement E and take the characteristic function f of E then f is continuous on E(being a countable disjoint union of intervals) and it is discontinuous on C since it is perfect and nowhere dense in R and since f is 0 on C. 
