How do they determine whether a mole is cancerous or not? Is biopsy the only sure way?

Yes. A dermatologist has the highest skill level to be able to visually determine whether a mole is cancerous or not and can use a dermatoscope to add in visual diagnosis but the only 100% method is to biopsy the mole and send to a pathology lab for reading.