Out of 32 people, 75% of them are in the AI department (75% of 32 =24) & the remaining (8) are in cyber security
There is no overlap between the two branches, hence on proceeding further
In AI,
No of masters to non masters degrees are in the 5:3 ratio which means there are 8x=24 if we assume masters & non masters degrees to be 5x & 3x respectively.
X=3
Hence masters degree there are 15 people & non masters there are 9 in the AI department
When it comes to Cybersecurity, ratio of masters to non masters is 3:5 hence there are 8y=8 if we assume masters & non masters degrees to be 3y & 5y respectively.
Y=1
Hence masters degree there are 3 people & non masters there are 5 in the Cybersecurity department
Hence the ratio of total masters to non masters degree across both departments is (15+3)/(9+5)=18/14
On simplification this comes out to be 9/7
Here p/q denotes ratio of masters to non masters degree, hence the answer is
P=9
Q=7