Refugee and Visa exemption

Can a refugee from country X that have residency (and travel paper) from country Y visit country Z without a visa if country Z have a visa exemption program for citizen of country X ?

What if country Z had a visa exemption program for citizen of country Y ?