are x rays mechanical or electromagnetic
No, an X-ray is not a mechanical wave. An X-ray is an electromagnetic wave. However, in polar molecules, an X-ray can cause the molecule to vibrate rapidly, just like a microwave oven can.