An aldol condensation is an organic reaction in which an compound reacts with other a carbonyl compound (at least one should have alpha hydrogen) to form a β-hydroxyaldehyde or β-hydroxyketone, followed by a dehydration give conjugated unsaturated aldehyde or ketone.
it takes place in basic medium as it includes formation carbanion at @ carbon (alpha carbon) by removal of alpha hydrogen. this anion formed attacks on the carbonyl carbon of other compound and a beta hydroxy carbonyl compund is formed.
carbanion is formed by that carbonyl compound which has less positive charge on carbonyl carbon compared to other.
in propanal and ethanal positive charge on carbonyl carbon of ethanal( due to inductive effect of CH3) is less hence anion is formed by ethanal which attacks on propalnal. which forms beta hydroxy pentanal. and on heating forms alpha beta unsaturated pentene.
HOPE YOUR DOUBT IS SOLVED
PLEASE APPROVE THE ANSWER IF YOU LIKE IT
THANKS