In this paper we analyze survival data of populations of sterilized nematodes, Caenorhabditis elegans, exposed to heat shocks of different duration at the beginning of their adult lives. There are clear hormesis effects after short exposure to heat and clear debilitation effects after long exposure. Intermediate durations result in a mixture of these two effects. In this latter case, the survival curves for the control and experimental populations intersect. We show that observed effects may be explained by using a model of discrete heterogeneity. According to this model, each population of worms in the experiment is a mixture of subcohorts of frail, normal, and robust individuals; exposure to heat changes the initial proportion of worms in the subcohorts (heterogeneity distribution); and these changes depend on the duration of exposure. In other words, exposure to heat does not influence mortality rates (survival functions) in the subcohorts but does cause individuals to move from one subcohort to another. In a biological interpretation of this finding we hypothesize that, when coping with stress, the organisms of worms use several lines of defense. Switching these lines on and off in response to stress in individual organisms generates the spectrum of observed survival effects at the population level. We discuss possible molecular biological mechanisms of stress response and directions for further research.