More people would want to improve the quality of their life if they were terminally ill rather than lengthen it, according to a study.