Reaction of dihalides with excess of NaNH2
this once was my doubt...terminal alkynes are preferred because the acidic hydrogen at the terminal carbon is acidic(sp hybrid of Carbon) and which when taken up by the base gives a species with a negative charge on sp hybridized carbon which is indeed stable...so this provides the incentive for forming a terminal alkyne as the final product.

Trusted source: Jerry March Organic Chemistry 6th edition.


  When the base is NaNH2 1-alkynes predominate (where possible), because this base is strong enough to form the salt of the alkyne, shifting any equilibrium between 1- and 2-alkynes. When the base is $\ce{OH-}$ or $\ce{OR-}$, the equilibrium tends to be shifted to the internal alkyne, which is thermodynamically more stable.