Optimal query error of quantum approximation on some Sobolev classes