Noncoding RNAs (ncRNAs) are important regulatory molecules that function owing to their specific secondary structures. The secondary structure depends on the RNA sequence and can be viewed as a combination of loops, stems, and pseudoknot regions. Each local RNA part, as well as the entire molecule, tends to achieve the minimal free energy by assuming a certain structure. New mutations may change the free energy of the current RNA structure so that another structure becomes optimal, thus altering the RNA function. The chance that a mutation will cause structural alterations depends on the mutation position in the RNA secondary structure. Divergence estimates have been found to differ between paired and unpaired regions, the difference arises because selection is aimed at preserving the ncRNA secondary structure. A more detailed analysis of the evolutionary differences between loops and stems in all of the most important ncRNA classes may be of interest for developing the algorithms to search a genome for ncRNA genes. This study focused on natural selection acting on the loop and stem regions in five ncRNA classes. An attempt was made to associate selection characteristics with changes in free energy. The Drosophila melanogaster genome was used as a model.