This is an example of a common Mechanics 1 question. I teach a systematic approach to such questions.
Diagram - dram diagram of the pulley set up
Label forces on diagram - Tension from string acting vertically upward and weights from masses vertically downward. Make sure they define the positive direction. Also use a double headed arrow to show acceleration.
Think about it physically - You can infer from the fact that Q accelerates downwards that m > 0.4. This can be used as a sanity check for the answer later on. Since the string is inextensible both masses experience the same tension and undergo the same acceleration.
Apply N2 - F=ma, I would test whether the student understood what F is (Net force on the particle). For particle P generate the equation T - 0.4g = 0.4 x 2.45. Check student deals with forces and directions correctly. This is solved to give T=4.9N. For particle Q generate the equation mg - T = m x 2.45. This can be solved to give m = 2/3 kg.
Sanity Check - 2/3kg > 0.4kg
Could extend the problem further by thinking about the kinematics of motion. The speed of the two masses after a certain time. Test whether the students understand that the acceleration is constant until the pulley is reached by the rising mass.