Step-by-step explanation:
If someone purchases stocks of a company and right after two days of purchasing, the stocks rise above with an increase of $2.5 per share, then the person can surly sell the stocks to earn profits. He purchased the stocks at a price of say $25 and after two days the stocks reaches at $27.5 per share, which means he is gaining $2.5 on each share of purchased stock. He can sell it after two days. If he sells it and enjoys the profit, then he will not be entitled to receive the dividends, because dividends are given to stock holders who have share in the company, but is someone sells his share, he doesn't has a share in that company and thus is not liable to receive the dividend.
Secondly yes, he can hold the profits and decide not to sell the stocks, because he can hope to have more profits on the shares in the coming days, but this is again a risk. If he wishes to take risk, he should hold the stocks, so that he can still enjoy the dividend at the end of the quarter if he holds it.