For the first question, px^2 – qx +p=0 has rational solution iff there exists an positive integer n such that q^2-4p^2=n^2 iff (q+n)(q-n)=4p^2. Since p is prime, there are 18 possible cases for distributing the factors on the right hand side to the two factors on the left hand side. The first 9 cases are (4p^2, 1), (1, 4p^2), (4p, p), (p, 4p), (2p, 2p), (2, 2p^2), (2p^2, 2), (4, p^2), (p^2, 4) where (a,b) denotes q+n=a and q-n=b. And the other 9 cases are (-a, -b) where (a,b) is one of the first 9 cases. Since 2q=a+b, the number of cases reduces to 10. (i) a=4p^2, b=1: impossible since left side always even but right side always odd. (ii) a=4p, b=p: 2q=5p, so q=5 and p=2. (iii) a=2p, b=2p: 2q=4p => q=2p, impossible since p>1 (iv) a=2p^2, b=2: 2q=2p^2+2 => q=p^2+1. Suppose q is even, then q=2, then p=1, contradiction, so q is odd. So p is even, hence p=2, q=5. (v) a=4, b=p^2: 2q=4+p^2 => no solution since when p=2, q=4 which is not prime. When p is not 2, right side is not even. Similarly for the other 5 cases, we have q=-5, p=-2

So all the possible choices for p and q are p=2, q=5 and p=-2, q=-5