This question was asked in my exam yesterday and this is what I did.Will I get marks here?
Let $ f : \mathbb R \rightarrow \mathbb R$ be a bounded Lebesgue measurable function such that $\int_a^b f =0$ for all real $a,b.$
Show that $\int _E f=0$ for each subset $E $ of $\mathbb R $ of finite Lebesgue measure.
Since $m(E)<\infty$ so given $\epsilon>0$ there exists an open set $O\supseteq E$ such that $m(E)-m(O)<\epsilon.$ Now $E$ is measurable $\implies m(E\setminus O)<\epsilon$.
Also $O$ can be expressed as disjoint union of open intervals $O=\cup_{n=1}^\infty (a_n,b_n)$.
By Dominated Convergence Theorem, $\int _O f=\sum _{n=1}^\infty \int_{(a_n,b_n)} f$ and hence $\int _O f=0$
Hence $\int _O f=\int _E f+\int _{E\setminus O} f\implies \int _E f=0$ since $m(E\setminus O)=0$.
Please check my proof.