[tex]\mathbf F(x,y)=x^2\,\mathbf i+y^2\,\mathbf j[/tex]
If a scalar function [tex]f(x,y)[/tex] exists for which [tex]\nabla f(x,y)=\mathbf F(x,y)[/tex], then we'd have
[tex]\dfrac{\partial f}{\partial x}=x^2\implies f(x,y)=\dfrac{x^3}3+g(y)[/tex]
[tex]\implies\dfrac{\partial f}{\partial y}=y^2=g'(y)\implies g(y)=\dfrac{y^3}3+C[/tex]
so the scalar function would be given by
[tex]f(x,y)=\dfrac{x^3+y^3}3+C[/tex]
where [tex]C[/tex] is an arbitrary constant.
Presumably, this question is being asked in the context of the line integral of [tex]\mathbf F(x,y)[/tex] along the given contour [tex]C[/tex]. Since [tex]\mathbf F(x,y)[/tex] is conservative - and consequently a scalar potential function [tex]f(x,y)[/tex] exists - we can simply use the gradient theorem to evaluate the line integral. We would get
[tex]\displaystyle\int_C\mathbf F\cdot\mathrm d\mathbf r=f(2,8)-f(1,2)=\dfrac{511}3[/tex]
(and we get the same answer by parameterizing [tex]C[/tex] and computing the integral as we usually would)