With the answers provided, just give the question a try. Such
questions are interesting but i'm too lazy to work it out.
Use the test to determine the number of double bonds, their
position, type and position of O etc etc.
Start with the smallest which is Q, you know its an acid since
it reacts with Na2CO3 and there is only 1 acid you can form with
that formula..
P reacts with carbonates as well so you do expect another acid
and with such a low number of C, you might expect a diacid and with
the dinitrophenylhydrazine test, determine the structure.
For N, what does fehling test and iodine test tells you? Looking
at the number of C and H, it would be too little H for alkyl chains
so a good guess would usually be a benzene ring.
With that 3, you can try to piece them together to get your M
with the tests done.