A substance X is a compound of an element of group 1, and gives violet colour in flame test. X is:
CsCl
KCl
LiCl
NaCl
Since potassium gives violet colour on flame test, the substance X is KCl.