Hi, can international student with expired student visa & study permit leave Canada without visa? Does he still need a transit visa if he left from Ottawa, transit in Toronto and then going back to his country by plane?
You can leave Canada by whatever means you want with or without any type of visa or permit even if expired just you cannot come back without at least a TRV if not visa exempt.
Same goes for a domestic flight Ottawa transiting via Toronto to leave the country as long as you have a valid passport no problem at all as your status in Canada is not relevant either for the domestic segment or leaving on an international flight out of Toronto.
Transit visas by the way are only required for non visa exempt people flying into Canada transiting to a flight out of Canada but not for domestic flights within Canada.