a. In the given reaction, the terminal alkyne loses a proton to form the carbanion, as shown in the first step of the given reaction. In the next step, the formaldehyde acts as an electrophile and reacts with the terminal carbanion, as shown in the following reaction:

The reaction of the acetylide with the
In the final step, there is an addition of proton, which results in the following product:

Addition of a proton
b. In the first step of the given reaction, there is protonation of the -OH group. Thereafter, there is a loss of a water molecule to form the carbocation, which is resonance stabilized, as shown in the following structure:

Formation of a resonance stabilized carbocation
In the next step, a nucleophilic attack of a water molecule on the carbocation takes place, followed by the abstraction of the proton by the ion:

Nucleophilic attack of the water molecule
In the next step, reacts to produce the desired product, as shown in the following steps:

Removal of a proton

Attack of to form the resonance stabilized carbocation and the desired product