Section 9. He shall, when required by either branch of the general court, attend during its sessions and give his aid and advice in the arrangement and preparation of legislative documents and business, and shall give his opinion upon questions of law submitted to him by the governor and council or by either branch of the general court. He, or some person designated by him, shall, when requested by a vote of a legislative committee, appear before such committee and advise it upon the legal effect of proposed legislation pending before it.