Q= 2 3 4 1 5, if I understand your notation, would also be written
\left(\begin{array}{ccccc}1 & 2 & 3 & 4 & 5 \\ 2 & 3 & 4 & 1 & 5\end{array}\right)
and means that 1 is changed into 2, 2 is changed into 3, 3 is changed into 4, 4 is changed into 1, and 5 is changed into itself (remains the same). P= 1 2 5 3 4 is
\left(\begin{array}{ccccc}1 & 2 & 3 & 4 & 5 \\ 1 & 2 & 5 & 3 & 4\end{array}\right)
and means that 1 and 2 remain the same, 3 is changed into 5, 4 is changed into 3, and 5 is changed into 4. The standard convention is that Q.P means that P is applied first, then Q (but check with your teacher or text- that varies). So P leaves 1 along and then Q changes 1 to 2: together, 1 changes to 2. P leaves 2 alone and then Q changes 2 to 3: together, 2 changes to 3. P changes 3 to 5 and then Q leaves 5 alone: together, 3 changes to 5. P changes 4 to 3 and then Q changes 3 to 4: together 4 remains the same. P changes 5 to 4 and then Q changes 4 to 1: together 5 changes to 1. That is the permutation
\left(\begin{array}{ccccc}1 & 2 & 3 & 4 & 5 \\ 2 & 3 & 5 & 4 & 1\end{array}\right)
In your notation I think that would be 2 3 5 4 1.
Similarly, P.Q means that we apply Q first. Q changes 1 to 2 and then P leaves 2 alone: together 1 changes to 2. Q changes 2 to 3 and then P changes 3 to 5: together 2 changes to 5. Q changes 3 to 4 and then P changes 4 to 3: together 3 stays the same. Q changes 4 to 1 and then P leaves one alone: together 4 changes to 1. Q leaves 5 alone and then P changes 5 to 4: together 5 changes to 4. That is
\left(\begin{array}{ccccc}1 & 2 & 3 & 4 & 5 \\2 & 5 & 3 & 1 & 4\end{array}\right)
or, in your notation 2 5 3 1 4.
Again check your text's convention on order. If what your text has reverses those two answer, it is using the other convention.