a. The $\sigma$-algebra generated by $E$, $\sigma(E)$, is the $\sigma$-algebra of countable or co-countable sets (sets whose complement is countable).

Let $F$ be the set of countable or co-countable sets of $X$, $F:=\{A\subset X| A$ is countable or $A^c$ is countable$\}$. We will prove that $F = \sigma(E)$.

1. $F\subset \sigma(E)$

Let $A\in F$. If $A$ is countable set, $A=\{a_1, a_2,\dots \}$. We can write $A$ as the union of countable elements in $X$: $A=\cup_{i=1}^\infty \{a_i\}, a_i \in X$. Since $\sigma(E)$ is a $\sigma$-algebra, it contains all countable unions of elements in $E$, so $A \in \sigma(E)$.

Now, if $A^c$ is countable, by the previous argument, $A^c \in \sigma(E)$. And since $\sigma(E)$ is a $\sigma$-algebra, it contains the complements of every set in $\sigma(E)$, so $A = (A^c)^c \in \sigma(E)$.

This proves $F\subset \sigma(E)$.

2. Now, let's prove that $\sigma(E) \subset F$

Notice that $E\subset F$ since every singleton set is finite and hence countable.

Now, $F$ is a $\sigma$-algebra itself:

Countable unions: suppose $A_1, A_2, \dots \in F$. If all $A_i$'s are countable, the union $\cup_{i=1}^\infty A_i$ is also countable. If at least one $A_j$ is co-countable then $(\cup_{i=1}^\infty A_i)^c = \cap_{i=1}^\infty A_i^c\subset A_j^c$, which is countable, so $\cup_{i=1}^\infty A_i$ is co-countable as well and belongs to $F$.

Finite intersections: suppose $A_1, A_2, \dots A_n \in F$. If all $A_i$'s are co-countable then $(\cap_{i=1}^n A_i)^c =\cup_{i=1}^n A_i^c$ is countable. If at least one $A_j$ is countable then $\cap_{i=1}^n A_i \subset A_j$ so $\cap_{i=1}^n A_i \subset A_j$ is also countable, and hence it belongs to $F$.

Empty set: $\empty$ is a countable set, so it belongs to $F$.

Because $E\subset F$, $\sigma(E) \subset \sigma(F) = F$.

b. Suppose $f: (X,\sigma(E)) \rightarrow (\mathbb{R},\mathbb{B}(\mathbb{R}))$ is measurable with respect to the Borel-$\sigma$ algebra of $\mathbb{R}$. We want to see what implications this has on $f$.

We consider two cases.

Case 1. $X$ is countable. Let $A\in \mathbb{B}(\mathbb{R})$. Since $f^{-1}(A) \subset X$ and $X$ is countable, $f^{-1}(A) $ is countable too, so $f^{-1}(A) \in \sigma(E)$. In other words, every function is measurable.

Caae 2. $X$ is uncountable (we prove in this case that $f$ has to be constant, except possibly in a countable set).

If $f$ is constant, then either $f^{-1}(A) = \empty$ (hence, countable) or $f^{-1}(A) = X$ (hence, co-countable). In any case $f^{-1}(A) \in \sigma(E)$. So constant functions are measurable.

Now, suppose $f$ takes on two different values, $z$ and $y$. Suppose both $f^{-1}(\{z\})$ and $f^{-1}(\{y\})$ are uncountable. Since $f$ is measurable, then $\left(f^{-1}(\{z\})\right)^c =f^{-1}(\{z\}^c) = f^{-1}(\mathbb{R}\setminus \{z\})$ and $\left(f^{-1}(\{y\})\right)^c =f^{-1}(\{y\}^c) = f^{-1}(\mathbb{R}\setminus \{y\})$ are both countable.

But since $\mathbb{R} =(\mathbb{R}\setminus \{z\}) \cup (\mathbb{R}\setminus \{y\})$, $X = f^{-1} (\mathbb{R}) =f^{-1} (\mathbb{R}\setminus \{z\}) \cup f^{-1} (\mathbb{R}\setminus \{y\})$, meaning that $X$ would be countable, a contradiction.

Hence, at least one of $f^{-1}(\{z\})$ or $f^{-1}(\{y\})$ is countable. In fact, there is at most one $z \in \mathbb{R}$ for which $f^{-1}(\{z\})$ is uncountable. If there were two, we would repeat the previous argument and reach a contradiction.

If there is indeed one $z$ such that $C_{Z}:=f^{-1}(\{z\})$ is uncountable, then $f^{-1}(\{z\}^c)$ is countable, so we write it as $f^{-1}(\{z\}^c) =\{a_1, a_2, \dots \}$. Then, we can write $f$ as: $$f(x) = f(z)\cdot 1_{C_{Z}} + \sum_{i=1}^\infty f(a_i)\cdot 1_{\{a_i\}}$$ where $1_{C_{x}}, 1_{\{a_i\}}$ are indicator functions. This means that $f$ is constant except at a countable set (in which it can take at most countable different values).

Now we prove that if there is no such $z$ value, we reach a contradiction as well.

If $\text{Range}(f)$ is countable, $\text{Range}(f) = \{y_1, \dots, \}$, then $X = \cup_{i=1}^\infty f^{-1} (\{y_i\})$ would be a countable union of countable sets, so it would be countable.

If $\text{Range}(f)$ is uncountable, since $\mathbb{R} = \cup_{n \in \mathbb{Z}} [n,n+1]$, $X = \cup_{n \in \mathbb{Z}} f^{-1}\left([n,n+1]\right)$. If all $f^{-1}\left([n,n+1]\right)$ were countable, $X$ would be countable. A contradiction. So at least one of $f^{-1}\left([n,n+1]\right)$ is uncountable. Define $[a_1, b_1]$ as said set whose preimage under $f$ is uncountable.

Analogously,$[a_1, b_1] = [a_1, \frac{1}{2}(a_1+b_1)] \cup [\frac{1}{2}(a_1+b_1),b_1]$, so $f^{-1}([a_1, b_1]) = f^{-1}([a_1, \frac{1}{2}(a_1+b_1)]) \cup f^{-1}([\frac{1}{2}(a_1+b_1),b_1])$. Once again, at least one of these preimages must be uncountable, so we define $[a_2, b_2]$ as said corresponding set. We proceed in this manner, defining a sequence of nested closed intervals, all with uncountable preimages. By construction, $|b_n-a_n|= 2^{-(n-1)}$, so the intersection of this nested sequence of closed intervals is a single point $z := \cap_{n=1}^\infty [a_n, b_n]$.

Since $f$ is measurable, $f^{-1}([a_n, b_n])$ being uncountable means $f^{-1}([a_n, b_n])^c$ must be countable for all $n$, so that $f^{-1}(\{z\}^c) = \cup_{n=1}^\infty f^{-1}([a_n, b_n])^c$ is countable. That means $f^{-1}(\{z\})$ must be uncountable. Otherwise, $X =f^{-1}(\{z\}^c) \cup f^{-1}(\{z\})$ would be countable. A contradiction, since we assumed there was no $z$ value for which $f^{-1}(\{z\})$ is uncountable.