The correct option is B 2- South,4- South
Since the leftmost end of the magnet X is marked as the north pole, its right end (2) will surely be the south pole. This is because every magnet consists of two poles, namely the north and the south pole.
Also it is given in the question that the two bar magnets attract each other. We know that unlike poles attract each other. Here, the two bar magnets are attracted through poles 2 and 3. This means that poles 2 and 3 are unlike.
We have already figured out that end 2 is the south pole. So, as end 3 is attracted to end 2, end 3 will be the north pole.
Similarly, since end 3 is the north pole, end 4 will surely be the south pole.