Step 1: Understand degrees of freedom.
Degrees of freedom refer to the number of independent ways in which a molecule can possess energy. For a molecule, these include translational, rotational, and (at high temperatures) vibrational modes.
Step 2: Describe the structure of a diatomic molecule.
A diatomic molecule consists of two atoms connected by a bond, forming a dumbbell-like structure. The axis joining the two atoms is called the bond axis.
Step 3: Identify the rotational axes.
The molecule can rotate about three possible axes: (1) an axis perpendicular to the bond axis in the horizontal plane, (2) an axis perpendicular to the bond axis in the vertical plane, and (3) the bond axis itself.
Step 4: Apply the constraint for the bond axis.
Rotation about the bond axis (axis 3) is not counted because the moment of inertia about this axis is negligibly small (atoms are point masses lying on this axis). So rotation about this axis carries negligible kinetic energy and is excluded.
Step 5: Count valid rotational degrees of freedom.
Only the two axes perpendicular to the bond axis contribute significant rotational kinetic energy. Therefore, a diatomic molecule has: \[ f_{\text{rot}} = 2 \]
Step 6: State the final answer.
The number of rotational degrees of freedom of a diatomic molecule is 2. \[ \boxed{2} \]