The coordinates of the line joining the points are (3p, 4)and (-2, 2q)
so, the midpoint will be,
[(3p - 2)/2 , [(4+2q)/2)]
and given coordinates of midpoint are (5, p)
therefore,
[(3p - 2)/2 , [(4+2q)/2)] = (5 , p)
comparing the x coordinates on both sides we have,
(3p - 2)/2 = 5
=> 3p - 2 = 10
=> 3p = 12
=> p = 12/3
=> p = 4
comparing the y coordinates on both sides we have
(4+2q)/2 = p
=> 4+2q = 2p
=> 4+2q = 2 x 4
=> 4+2q = 8
=> 2q = 8 -4
=> 2q = 4
=> q = 2