There are 40 children in a row.
P is 13th from the left end, so:
Position of P from left = 13
Q is 10th from the right end. To find Q's position from the left:
Position of Q from left = 40 - 10 + 1
Position of Q from left = 31
M is fourth to the right of P:
Position of M from left = 13 + 4
Position of M from left = 17
The children are arranged as: ... M (position 17) ... Q (position 31) ...
Number of children between M and Q = 31 - 17 - 1
Number of children between M and Q = 13
Therefore, there are 13 children between Q and M.