If X = {all the perfect squares less than 40} Y = {all the odd…