How does a solenoid behave like a magnet? Can you determine the north and south poles of a current-carrying solenoid with the help of a bar magnet? Explain.