What will happen to a solenoid with a bar magnet core? Suppose I wrap wire around a bar magnet, creating a solenoid such that the poles of a bar magnet and the poles of solenoid are opposite to each other. If I were to hold a compass near one side, which pole would the compass detect? That of the bar magnet or of the solenoid?
 A: The influences of fields, such as the magnetic field around a bar magnet or solenoid, have a fantastic property: they can be summed. The total magnetic field at a point can be evaluated as the vector sum of the magnetic fields of each source on its own.
In your example, the magnetic field strength and direction near one pole will be the vector sum of the magnetic field of the magnet (considered on its own), plus the magnetic field of the of the solenoid. The direction shown by the compass needle will depend on which field is stronger, the magnet or the solenoid.
This is similar to working with forces. E.g. 2 people pull a rope in a tug of war, which way does the rope move, and how quickly does it accelerate? It depends on the strengths of the people and the force they apply (and thus the resulting net force).
A: The following 3 scenarios are possible
1. Magnetic moment of bar magnet is equal to that of solenoid
In this case the compass will not respond to the magnetic field of either the solenoid or the bar magnet as they would be completely cancelling out each other.
2. Magnetic moment of bar magnet is greater than that of solenoid
In this case the compass will be showing the net magnetic field which would be a result of magnetic field of bar magnet minus the magnetic field of solenoid (favouring field of bar 
magnet)
3. Magnetic moment of bar magnet is lesser than that of solenoid
In this case again the compass will be showing the net magnetic field which would be a result of magnetic field of solenoid minus the magnetic field of bar magnet (favouring field of solenoid)
