Classify a halogenoalkane, choose a reagent for each product and follow lone pairs through the required hydroxide and ammonia mechanisms.
Classify the carbon bearing the halogen
In a halogenoalkane a halogen is bonded to a saturated carbon. A primary halogenoalkane has one carbon group attached to the carbon bearing X; a secondary has two; a tertiary has three. Count carbon neighbours of that carbon, not the total number of carbons or halogen atoms in the molecule.
CH₃CH₂CH₂Br is primary, CH₃CHBrCH₃ is secondary and (CH₃)₃CBr is tertiary. CH₃CH(CH₃)CH₂Br is still primary even though the next carbon is branched. Halomethanes are a separate simple case with no carbon neighbour, so do not try to call them tertiary because they have three hydrogen atoms.
The halogen is more electronegative than carbon, making Cδ+–Xδ−. This leaves the carbon susceptible to a nucleophile: an electron-pair donor. OH⁻, CN⁻, H₂O and NH₃ have available lone pairs. A nucleophile need not have a negative charge; ammonia and water are neutral.
