Q has electronic configuration of 2, 8, 2
Z has electronic configuration of 2, 7
Q needs to lose 2 electrons to have full outer shell and Z needs 1 electron to have full outer shell.
Q has a valency of 2 and Z has a valency of 1. (two Z atoms are needed for each Q atom)
So the Empirical formula would be QZ2
The bonding would be ionic because Q loses two electrons and each Z atom gains one electron.