PART A)
magnetic field lines always originates from North pole and terminates at south pole
So here the two poles will attract each other and field lines are shown in the figure
Part B)
As we know that magnetic field lines originates from north pole and terminates at south pole so here upper end is north pole and lower end is south pole