Step 1: Understanding allyl group.
The allyl group has the structure \( \mathrm{CH_2=CH-CH_2-} \).
Step 2: Formation of allyl bromide.
When bromine replaces one hydrogen atom of the allyl group, allyl bromide is formed.
Step 3: Counting atoms.
Carbon atoms = 3, Hydrogen atoms = 5, Bromine atom = 1.
Step 4: Conclusion.
Thus, the molecular formula of allyl bromide is \( \mathrm{C_3H_5Br} \).