In Modern periodic table, Nitrogen is placed just before Oxygen in 2nd period because
Oxygen have one more proton in its nucleus than Nitrogen
Elements are classified in the Modern periodic table based on their increasing atomic number. So all the other reasons (even correct) will not be considered while deciding the placement of elements in the periodic table.
Now, atomic no. is the number of protons present in the nucleus of an atom. Nitrogen has 7 protons and Oxygen has 8. Hence Nitrogen is placed just before Oxygen.