For the law of sines, you would apply it in this particular problem like so:
Since P is 27, its angle is 33 and Q's length is 40; you would set it up like this
40/SinQ = 27/Sin33, multiply 40 with Sin33, then it would be 40Sin33, then divide it by 27. The result should be 40Sin33/27 = X