If the composition of a sample is fixed, the sample is a pure substance. According to the law of definite proportions (constant composition), components of a pure substance must be in definite ratios regardless of the source.
Non metals form ionic bonds by gaining and losing electrons to complete their valence she'll and increase stability.
Metals form covalent bonds by sharing electrons.