Since it is a lustrous, divalent element that reacts with both acids and bases, it is a metal. When a metal is treated with a base or an acid, it releases hydrogen gas.
In the mentioned reactions, the produced gas can be identified as hydrogen by bringing a glowing matchstick near the reaction vessel. Production of a pop sound is a confirmatory observation. The pop sound represents a minor explosion on combustion of inflammable hydrogen gas.
M(s)+2NaOH(aq)→Na2MO2(aq)+H2(g)M(s)+2HCl(aq)→MCl2+H2(g)