It is given that the value of (sin i / sin r) when light enters from medium P to medium Q is less than 1.
P is optically denser than Q
(sin isin r) < 1
=> sin i < sin r
i.e., angle of incidence < angle of refraction. It means it bends away from the normal. Hence, medium P is optically denser than Q.