In general, your residence is based on where you lived on Dec. 31 of that year.
If you were in Quebec only for basic training, and you kept your residence for Ontario (i.e. all your ties are still Ontario, your stay in Quebec is temporary and you plan on moving back home to Ontario), then your residence would still be Ontario.