For sake of convenience, I type a as alpha and b as beta.
Solution:
Sum of roots of the 1st equation
= a + b
= -p
Sum of roots of the 2nd equation = 8
(2a - 1) + (2b - 1) = 8
2(a + b) - 2 = 8
-2p - 2 = 8
p = -5
Product of roots of the 1st equation
= ab
= 5
Product of roots of the 2nd equation = q
(2a - 1)(2b - 1) = q
4ab - 2a - 2b + 1 = q
4(5) - 2(a + b) + 1 = q
20 - 2(5) + 1 = q
q = 11