Chi Square Test -- Contingency Table is probably another method for the two tasks.
@anotherhuman, @mahsa, @prithvi.raj, @reneelin, @vlado