(a) Valency of an element is the number of electrons which an atom of the element loses or gains or shares during a chemical reaction, in order to complete its octet.
By sharing electrons an element with atomic number 14 will show a valency of 4, as it has 4 electrons in its outermost shell. Electronic configuration (2,8,4).
(b) The electrons present in the outermost shell of an atom are known as the valence electrons. The valency of an element is either equal to the number of valence electrons in its atom or equal to the number of electrons required to complete eight electrons in the valence shell.
When an atom has to lose an electron to completely fill its outermost orbit , the valency of the atom is equal to the number of the valence electrons. But when an atom has to gain electrons in order to complete its octet, valency of the atom is equal to the number of electrons gained and not the number of valence electrons.
For example, in chlorine (atomic number = 17), the number of valence electrons is 7, but here the atom will not lose these electrons. Here, the atom will gain 1 electron to complete its octet. Therefore, here the valency will be 1.
On the other hand, if we consider the example of magnesium (atomic number = 12), the number of valence electrons is 2. Here, the atom will lose 2 electrons to fill its outermost orbit. Therefore, the valency is also 2.