How to calculate the number of atoms in a gas molecule?
Reason for rewrite: refer to edit summary.



From Wikipedia on Disulfur ($\ce{S2}$)


  This violet gas is commonly generated by heating sulfur above 720 °C 


Since the sulfur is well above $720^\circ\pu{C}$, it would most likely be in the diatomic state, more like an analogous structure to dioxygen ($\ce{O2}$).

We can also judge this from the molar ratios too, as rose22 has pointed out. Since it is given that $40~\pu{mL}$ of $\ce{SO2}$ is formed from $20~\pu{mL}$ of $\ce{S_x}$ (assuming the atomicity of $\ce{S}$ to be $x$ at this temperature) and $20~\pu{mL}$ of $\ce{O2}$, they must come to terms with a simple whole number ratio.

$$\ce{\underset{20~\pu{mL}}{S_x}+\underset{40~\pu{mL}}{xO2}-&gt;\underset{40~\pu{mL}}{xSO2}}$$ 

Statement 1: Since the ratio of volumes of gases at a particular temperature and pressure is equal to the ratio of amount of substance in moles, it is clear that:

$$1:x:x=20:40:40$$

That is to say, $x=2$, so the atomicity of sulfur here is $2$.

In the question, the OP said:


  However, I am uncertain as to whether this is correct as I did not utilize any of the gas laws. For this question, which of the gas laws should I have used?


Statement 1 is a  result from the universal gas law.

$$PV=n\text{R}T$$

When $P$ and $T$ are constant,

$$\frac{V_1}{V_2}=\frac{n_1}{n_2}$$

Some may argue that this relationship is called Avogadro law, but again, this law too is a gas law, evidently.