Physics‎ > ‎

## Summary

• A magnetic field is a region of space where a north magnetic monopole experiences a force.
• The only magnetic materials are iron, steel, nickel, and cobalt. We represent magnetic fields by drawing magnetic field lines.

### Properties of magnets

- can attract magnetic materials such as iron, steel, cobalt and nickel
- has 2 poles: North and South poles
- a freely suspended magnet always points in a fixed direction
- like poles repel and unlike poles attract

Note: repulsion is a sure test of the polarity of a magnet

### Magnetic induction

- the process of inducing magnetism in an unmagnetised magnetic material

### Magnetic materials:

- iron
- cobalt
- steel
- nickel

Use of magnetic materials

- permanent magnets
- compasses
- magnetic door stops
- loudspeakers
- electric meters
- Electromagnets
- magnetic relays
- electric bells
- audio or video tapes

- glass
- plastic
- wood
- rubber

### Electromagnetic induction

An experiment to show that a changing magnetic field can induce an e.m.f. in a circuit

• When a magnet is pushed into the solenoid, the pointer of the galvanometer deflects momentarily. induced current flows in the solenoid momentarily
• The experiment shows that induced current (or induced e.m.f.) is produced in the coil due to the changing magnetic field of the magnet
• This process by which induced current is produced is called electromagnetic induction
• When there is a change in the magnetic flux (field lines) linking a conductor, an electromotive force is induced between the ends of the conductor. This is called electromagnetic induction.
• If the conductor forms part of a circuit, the induced e.m.f. produces an induced current
• The change in the magnetic flux linking the conductor can be caused by
• relative movements between the conductor and the magnet (as shown above)
• changes in the magnetic strengths surrounding the conductor
• The size of the induced e.m.f. and hence the induced current, obeys the Faraday's law of electromagnetic induction which states that
• the induced e.m.f. in a conductor is proportional to the rate of change of magnetic lines of force linked to the conductor, or the rate at which the magnetic lines of force are being cut by the conductor

#### Factors affecting magnitude of induced e.m.f

Induced e.m.f. increased when
1. the magnet moves at a faster speed in and out of the coil
2. a stronger magnet is used
3. the number of turns in the coil is increased
Making a magnet by electrical method - most efficient method
• a steel bar to be magnetised is placed inside a solenoid
• direct current is passed through the solenoid, it becomes a magnet
- polarity of the magnet determined by
• viewing from one end of the solenoid
• if current flows in an anticlockwise direction, that end will be the North pole
• viewing from one end of the solenoid
• if current flows in a clockwise direction, that end will be the South pole

### Methods of demagnetisation

• Heating
• Hammering
• Using alternating current - most efficient method
A magnet to be demagnetised is placed inside a solenoid connected to an alternating current supply. The magnet will be demagnetised when it is slowly removed from the solenoid with the alternating current flowing in it.

### An experiment to plot the magnetic field of a bar magnet

• Place the bar magnet at the centre of a piece of paper with its N-pole facing North
• Place the compass near the magnet and mark the positions (X and Y) of the ends of the compass needle. Move the compass until the S-pole end of the compass needle is exactly at Y.
• Repeat the process of marking the dots. Join the dots to give a plot of the field lines of the magnetic field.

### Change in the direction of the induced current when a S-pole is inserted into the solenoid instead of a N-pole

When the N-pole of a magnet is pushed into the solenoid, the galvanometer deflects.

When the S-pole of a magnet is pushed into the solenoid, the galvanometer deflects in the opposite direction

Note: induced current flows in the opposite direction

Lenz's Law: Direction of an induced e.m.f. opposes the change producing it.

### Change in the direction of the induced current when a N-pole of the magnet is withdrawn from the solenoid instead of being inserted into it

When the N-pole of a magnet is pushed into the solenoid, the galvanometer deflects.

When the N-pole of a magnet is withdrawn from the solenoid, the galvanometer deflects in the opposite direction.

Note: induced current flows in the opposite direction.

Note: If the solenoid is moved while the magnet is stationary, there will also be induced current flowing in the solenoid.

### Electromagnetic Effects

#### Generator

• A device in which a coil is rotated in a magnetic field to produce electricity
• The kinetic energy of a rotating coil in a running generator s converted mainly into electrical energy
DC Generator

Diagram of a d.c. generator
• consists of a rectangular coil of wire connected to a pair of slip rings.
• coil is placed between the N-pole and S-pole of a magnet
• when the coil is rotated, the magnetic field linked with the coil changes and an e.m.f. is induced in the coil.
• the slip rings (or commutator) connect the same carbon brush to the same end of the coil so that current can flow to an external load.
AC Generator
• As the coil is rotated, the two sides of the coil move up and down in the magnetic field between the permanent magnets
• The cutting of magnetic lines of force by the two sides produces an induced current in the coil
• The induced current flows in the direction in accordance with Lenz's Law
• Each time the plane of the coil passes through the vertical, the current in the coil changes its direction of flow while the commutators change over. These two changes cancel each other out, so the current will continue to flow in 1 direction.
• As the coil is rotated, the two sides of the coil moves up and down in the magnetic field between the permanent magnets
• The cutting of magnetic lines of force by the sides produces in induced current in the coil
• The induced current flows in the direction in accordance with Lenz's Law
• Each time the plane of the coil passes through the vertical, the current in the coil changes its direction of flow. So does the direction of flow of the current in the external circuit.
• The output is therefore an alternating current as shown in the graph below.

Graphs of a.c. and d.c. outputs against time

• The induced e.m.f. or current of a d.c. or an a.c. generator is increased by increasing the rate of cutting the magnetic lines of force, by:
• increasing the speed of rotation of the coil
• increasing the number of turns in the coil
• winding the coil on a soft iron core so as to concentrate the magnetic lines of force through the coil. This increases the strength around the coil
• using stronger magnets

### Fleming's right hand rule - for generators/dynamo

To determine the direction of induced current in the coil (Generators)

#### Factors affecting the magnitude of induced e.m.f.

The induced e.m.f. of the ac generator can be increased by
• increasing the speed of rotation of the coil
• increasing the number of turns of the coil
• winding the coil on a soft iron core
• using stronger magnets

### Pattern of a magnetic field due to a current in a straight wire • The magnetic field forms concentric circles around the wire.
• The circles are closer together near the wire than when further away from the wire
• The direction of field can be determined by using the right hand grip rule below.
• When current flows through a conductor a magnetic field forms.
• The field lines form concentric circles around the conductor.
• Right hand grip rule
• Hold a straight wire in your right hand with your thumb pointing in the direction of conventional current (positive flow).
• Your fingers circle the wire in the direction of the magnetic field.
• The compasses in the following diagram indicate the direction of the magnetic field near the conductor.
• Use your left hand for electron flow.
The following diagram shows a conductor carrying conventional current out of the page (toward the observer), and the direction of the field near the conductor.

### Pattern of a magnetic field due to a current in a solenoid

- The magnetic field resembles that of a bar magnet
- The direction of the magnetic field can be determined by the right hand grip rule
- The other method is by viewing at one end of the solenoid
- if current flows in anticlockwise direction --> North pole
- if current flows in clockwise direction --> South pole

### Increasing magnetic field strength by

- increasing magnitude of current
- increasing number of turns per unit length of solenoid
- using a soft-iron core within the solenoid

### Fleming's Left Hand Rule - For Motors

• Thumb: Motion/Direction of force
• Forefinger: Direction of magnetic field
• Centre finger: Direction of current ### Current-carrying coil in a magnetic field experiences a turning effect (d.c. motor)

• The coil is connected to a split-ring commutator
• When current flows through the coil, the force acting on the coil will turn the coil in a clockwise direction until the coil is in the vertical position
• There is no current flowing in the vertical position, but due to its momentum, the coil continues to rotate past the vertical position
• This reverses the direction of current in the coil. Thus, the coil continues to rotate in a clockwise direction
• The purpose of the split-ring commutator is to reverse the direction of current in the coil whenever the commutator changes its contact from one carbon brush to another, This ensures that the coil will rotate in a fixed direction

Turning effect of the wire coil increased when

1. the number of turns of the coil of wire is increased
2. the current is increased
3. the coil of wire is wound on a soft-iron core

#### Summary of Electromagnetism and Motor Effect

• If the current is parallel to the external magnetic field the two magnetic fields are at right angles to each other and cannot interact so no force is produced.
• Size of the force can be increased by:
• Using a larger current
• Using a stronger external field

## MCQ Questions

1. It can be deduced that a piece of metal is already a magnet if
a. copper wire is attracted to it
b. both ends of a compass needle are attracted to it
c. a magnet is attracted to it
d. one end of a compass needle is repelled by it
e. copper wire is repelled by it

2. Which two materials are most likely to be used for the coil and core of an electromagnet?
coil          core
a. copper      air
b. copper      iron
c. copper      steel
d. iron          iron
e. iron          steel

3. Which of the following statements describes an example of induced magnetism?
a. two north poles repel each other, but a north pole attracts a south pole
b. a bar magnet, swinging freely, comes to rest pointing north-south
c. a bar magnet loses its magnetism if it is repeatedly dropped
d. a bar magnet attracts a piece of soft iron
e. it is hard to magnetise steel, but easy to magnetise soft iron

4. A small compass is placed beside a bar magnet.
In which direction will the compass needle point?

5. The diagram shows a sheet X of material used to provide magnetic shielding for a sensitive meter near a transformer.
Which material is suitable for X?
a. copper
b. glass
c. iron
e. perspex

6. Which of the following could be used for the needle of a plotting compass?
a. aluminium
b. brass
c. copper
d. iron
e. steel

7. A direct current I flows upwards in a vertical wire. Which diagram shows the direction and shape of the magnetic field in the region of the wire?
(hint: use right hand grip rule)

8. In which device is a permanent magnet used?
a. electric bell
b. electromagnet
c. plotting compass
d. relay
e. transformer

9. Which of the following is the best way to demagnetise a magnetised steel needle?
a. break it into two pieces
b. make it red hot and then let it cool
c. leave it next to another strong magnet
d. leave it inside a solenoid carrying direct current
e. slowly pull it out of a solenoid carrying alternating current

10. Which of the following methods of magnetising a steel rod will produce the strongest magnet?
a. bringing a permanent magnet near to the rod
b. holding the heated rod in an N-S direction and tapping strongly
c. passing an electric current through the rod
d. placing the rod in a solenoid carrying a large direct current
e. stroking the rod with a permanent magnet

11. A coil of copper wire wrapped around a core could be used as an electromagnet. Which of the following combinations would produce the strongest electromagnet?
number of turns          core
a.         few                              soft-iron
b.         few                              steel
c.         many                           copper
d.         many                           soft-iron
e.         many                           steel

12. The diagram shows a beam of electrons about to enter a magnetic field. The direction of the field is into the page.
What will be the direction of the deflection, if any, as the beam passes through the field?
a. towards the bottom of the page
b. towards the top of the page
c. into the page
d. out of the page
e. no deflection

(hint: use Fleming's left-hand rule)

13. The diagram shows a piece of iron 3cm long placed near the S-pole of a magnet.
Which diagram best represents the magnetic field pattern?
14. Which of the following proves that a piece of soft iron is magnetised?
a. a magnet is attracted to it
b. the ends of a compass are attracted to it
c. an aluminium foil is attracted to it
d. one end of a magnet is repelled by it

15. A transformer has half the number of turns on the secondary coil than that on the primary coil. Which of the following statements about the output voltage is true?
Types of voltage        Maximum output voltage        Frequency
a.            alternating                doubled                                  no change
b.            alternating                halved                                    no change
c.            direct                        doubled                                  halved
d.            direct                        halved                                    doubled

16. There are 1000 turns in the secondary coil of a transformer and 500 turns in the primary coil. What will be the voltage across the secondary coil if an alternating voltage of 240 V is applied across the primary coil?
a. 60 V
b. 120 V
c. 480 V
d. 960 V

17. The direct current flows downwards in a vertical wire. Which diagram shows the direction and shape of magnetic field in the region of the wire?
18. The diagram shows a coil in a magnetic field.
The coil is part of a d.c. motor which is connected to a d.c. supply. The current, I, flows in the coil. Which direction will the coil rotate and what must be connected directly to P and Q of the coil?
Direction of rotation of coil            Part connected to P and Q
a.                clockwise                                split-ring commutator
b.                clockwise                                split-rings
c.                anticlockwise                          split-ring commutator
d.                anticlockwise                          split-rings

19. The strength of the magnetic field produced by a current-carrying wire depends on the
a. direction of the current
b. magnitude of the current
c. length of the wire
d. shape of the wire

20. An alternating current flowing through a coil produces a magnetic field having
a. zero strength
b. constant strength but alternating directions
c. constant directions but alternating strengths
d. alternating strengths and directions

21. Fleming's left-hand rule is also known as the
a. ampere rule
b. force rule
c. dynamo rule
d. motor rule

22. The magnetic field pattern produced by a coil carrying a direct current is similar to the magnetic field pattern of
a. two straight parallel wires carrying direct current in the same direction
b. two straight parallel wires carrying direct current flowing in opposite directions
c. a permanent bar magnet
d. a horseshoe permanent magnet

23. A current-carrying coil in a magnetic field will experience
a. a force of attraction
b. a force of repulsion
c. forces of attraction and repulsion
d. a turning effect

24. When a d.c. motor is connected to an a.c. supply, the coil will
a. rotate faster
b. stop rotating
c. rotate at uniform speeds
d. rotate at different speeds

25. In a d.c. motor, no force is acting on the coil when it is perpendicular to the magnetic field. This is because
a. no current is flowing through the coil
b. a small current is flowing through the coil
c. a large current is flowing through the coil
d. there is no magnetic field in the vertical position

26. Which one of the following appliances does not use the motor effect?
a. loudspeaker
b. microphone
c. galvanometer
d. ammeter

27. The function of the commutator in a d.c. motor is to
a. decrease the resistance of the coil
b. reverse the direction of the current in the coil
c. increase the strength of the magnetic field
d. increase the magnitude of the current flowing into the motor

28. Magnetic induction produces
a. a magnetic force
b. permanent magnetism
c. temporary magnetism
d. an induced e.m.f.

29. Which one of the following does not change the magnetic flux linking the conductor?
a. pulling the conductor away from a magnet
b. pushing the conductor and a magnet with the same velocity
c. pushing a magnet towards the conductor
d. pulling a magnet away from the conductor

30. There is no induced current in the coil when the magnet in the coil stops moving. This is because
a. the magnet loses all its magnetism
b. the magnetic strength in the coil is not changing
c. the magnetic strength in the coil is maximum
d. the magnetic strength in the coil is zero

31. The direction of the induced e.m.f. is given by
a. the induced e.m.f. rule
b. the cockscrew rule
c. Ampere's swimming rule
d. Fleming's right-hand rule

32. The main function of the commutator is to
a. enable the induced current to flow in the same direction through the external circuit
b. enable the coil to be rotated in the same direction
c. reduce the resistance of the coil
d. enable the induced current to flow in the same direction through the coil

33. Which of the following will not induce an e.m.f. in a coil?
a. moving a bar magnet towards a coil
b. moving a coil away from a bar magnet
c. passing a constant direct current through a coil
d. passing an alternating current through a coil

34. Each of the following changes will increase the output voltage of a simple generator except
a. increasing the speed of rotation
b. increasing the number of turns in the coil
c. increasing the distance between the two poles of the magnet
d. winding the coil on a soft iron core

35. There are 500 turns and 2000 turns in the primary and secondary coil of a transformer respectively. If the output voltage is 1000V, how large is the input voltage?
a. 250V
b. 500V
c. 2000V
d. 4000V

36. A transformer which is 80% efficient gives an output of 12V and 4A. What is the input power?
a. 13W
b. 38W
c. 60W
d. 154W

37. Which of the following will prove that a metal bar is a permanent magnet?
a. it attracts another magnet
b. it attracts both ends of a compass needle
c. it conducts electricity
d. it repels another magnet

38. Which of the following has no effect on the size of the turning effect on the coil of an electric motor?
a. size of the current in the coil
b. direction of the current in the coil
c. number of turns in the coil
d. strength of the magnetic field

39. When a magnet was pushed towards a solenoid, the sensitive meter connected to the solenoid deflected to the right.
When the same magnet was pulled away from the solenoid at the same speed, what was the deflection on the meter?
a. the same and to the right
b. greater and to the right
c. zero
d. greater but to the left
e. the same but to the left

40. Why is electrical energy usually transmitted at high voltage?
a. the resistance of the transmission cables is as small as possible
b. the transmission cables are safer to handle
c. as little energy as possible is wasted in the transmission cables
d. the transmission system does not require transformers
e. the current in the transmission cables is as large as possible

1. d.
2. b
3. d
4. e
5. c
6. e
7. b
8. c
9. e
10. d
11. d
12. a (note: since the electron beam enters from left to right, the direction of current is from right to left)
13. b
14. d
15. b
16. c
17. b
18. c
19. b
20. d
21. d
22. b
23. d
24. b
25. a
26. b
27. b
28. d
29. b
30. b
31. d
32. a
33. c
34. c
35. a
36. c
37. d
38. b
39. e (Lenz's law)
40. c

## Structured Questions - Worked Solutions

1. Two magnets A and B are placed with their poles as shown below.
a. draw arrows to show the directions of the forces exerted on the north pole of magnet A by each of the poles of magnet B

b. draw arrows to show the directions of the corresponding forces exerted on the south pole of B by each of the poles of A

c. draw an arrow to show the direction of the resultant force exerted by magnet B on magnet A. Label the arrow with letter R

d. explain why the resultant force acts in the direction you have shown in c.

Solution

a.

b. since the like poles are nearer to one another, the repulsive forces are stronger than the attractive forces. hence the resultant force is a repulsive force.

2a. Explain what is meant by
i. magnetic field
ii. electric field

b. Complete the diagram to show the pattern and direction of the magnetic field in the space around a bar magnet.
c. The figure below shows the electric field around two small charges.
Describe a simple experiment which could be used to confirm the presence of the field.

di. The figure below shows a positively charged sphere S placed near to an initially uncharged isolated conductor AB. Complete the diagram to show the charges induced in the conductor.
dii. Complete the diagram below to show the corresponding charges when S is negatively charged.

diii. Describe the motion of the electrons in AB when the charge on S alternates from positive to negative several times per second. State one effect this motion will produce.

Solution

ai. A magnetic field is a region in which a free pole (North) experiences a force

aii. An electric field is a region in which a charge experiences a force.

b.
c. A positively charged body is suspended by an insulating thread near the negative charge. It is observed to be attracted to the negative charge. This shows that the body experiences an electric force and that an electric field is present.

di.

dii.

diii. The electrons will move back and forth between the ends of AB at the same frequency as the charge on S alternates. This changing distribution of electrons heats up the conductor AB. If AB was freely suspended on a non-conducting thread, it would oscillate back and forth.

3. A large electric current is passed, in the direction indicated, through the vertical wire shown below.
Sketch on the card shown the pattern of the magnetic field around the wire (ignore the magnetic field of the earth). Indicate with an arrow the direction of the magnetic field at any one point.

How would you check this direction experimentally?

Solution

Place a compass on the card. The direction in which the North end of the compass needle points indicates the direction of the magnetic field at that point.

4. The diagram shows a coil of wire wound on a soft iron core. A current is passed through the coil in the direction indicated by the arrows.

a. Mark the N and S poles produced in the iron core.

b. Show by an arrow the direction in which the N end of a compass needle would point when placed at A.

c. A beam of electrons flow through the point B in a direction that is perpendicularly downwards into the paper. Show clearly by an arrow labelled F, the direction of the force exerted by the magnetic field on the electron beam.

Solution

5. The diagram shows a rectangular current-carrying coil mounted on a freely-pivoted horizontal shaft between the poles of a permanent magnet. The connections to a battery and the direction of the current in each side of the coil are shown: the sides of the coil are labelled J, K, L and M.
a. On the diagram, draw arrows to show the directions of forces, if any, acting on the sides, J, K, L, and M.

b. State what will happen to the coil as a result of these forces acting on it.

Solution

a.
b. The coil will make a half turn in the anticlockwise direction and the sides J and L interchange in positions. As such, the coil will rotate in the anticlockwise direction again for the next half turn. Hence the coil rotates alternately in the anticlockwise direction and then in the clockwise direction for each half turn.

6. The diagram shows a simple a.c. generator
a. Explain
i. why an e.m.f. is induced in the coil as it rotates
ii. how we know that at the instant shown in the diagram, the slip-ring P is positive

b. The coil rotates 2.5 times in each second. At this speed, the maximum value of the induced e.m.f. is 20mV. On graph paper, sketch a graph of e.m.f. against time for a time interval of 1 s from the instant shown in the diagram.

Solution

ai. When the coil is rotated, the magnetic field linked with the coil changes and an e.m.f is induced in the coil.

aii. Using Fleming's Right Hand Rule, the current flows in the anticlockwise direction in the coil. As the current leaves the coil at slip-ring P, it is thus positive.

b.

7. A power station generates electrical energy at 25 000 V, 12 000 A, The generator in the power station is connected to the primary coil of an ideal transformer. The transformer changes the voltage before the electrical energy is transmitted across the country. The output from the secondary coil of the transformer is 400 000 V.
a. Explain how a current in the primary coil produces an output voltage in the secondary coil.
b. Calculate the ratio of the number of turns in the primary coil to the number of turns in the secondary coil.
c. Calculate the output current from the transformer.
d. State one advantage of using a high voltage for the transmission of electrical energy.

Solution

a. When the ac passes in the primary coil, the direction of resultant magnetic flux alternates. This change of flux passing in the secondary coil induces an output voltage in it.

b. 25 000/400 000 = 1/16
ration = 1 : 16

c. 25 000 x 12 000 = 400 000 x I
J =  (25 000  x 12 000) / 400 000
current = 750 A

d. The energy loss in the cables is low. 1. What kind of electricity is caused by friction?

Static Electricity is caused by friction.

2. How are charged particles in matter affected when two objects are rubbed together?

All matter is made up of tiny particles that have electric charges. Some of these particles have a positive charge. Other particles have a negative charge. Rubbing two objects together may cause some of the negative charges to rub off one object. The charges move to the second object. This gives the second object a greater negative charge than the first object.

3. How is current electricity produced?

Current electricity is produced when negative charges move along a path.

4. What is a circuit? What are the parts of a circuit?

A circuit is the path along which negative charges move.

There are four parts to a circuit:
(1) There is a source of electricity Example: A battery
(2) There is a path along which charges can move. Example: A wire
(3) There is a switch that opens and closes the circuit. Example: A knife switch
(4) There is some object that uses the electricity. Example: A light bulb

5. Explain the difference between a complete circuit and an incomplete circuit.

When a switch is closed or turned on, the path of electricity is complete. The charges move. A circuit whose path is complete is called a complete circuit. When the switch is open, or turned off, the path is broken. The movement of charges stops. The path is incomplete. A circuit whose path is incomplete is called an incomplete circuit.

6. Explain how electricity is produced in a flashlight.

A dry cell battery is the source of electricity in a flashlight.

7. What are the three ways to make electricity?

Electricity can be made from chemical energy in dry cell batteries and wet cell batteries, and from mechanical energy in generators.

8. How is energy produced in a hydroelectric power plant?

A generator is a machine that uses a magnet to produce electricity. Power plants use large generators to make electricity for whole towns. Generators have moving parts. They need a source of energy to move the parts. Generators usually use fossil fuels, water, wind, or nuclear generated power.

9. What would show the magnetic field of a magnet?

A magnetic field can be seen when iron filings are sprinkled near a magnet. The iron filings form a pattern of lines. These lines are called lines of force. Lines of force show where the magnetic field is and what it looks like.

10. Explain the difference between the two poles of a magnet.

The ends of a magnet are called the poles. A magnetic field is strongest at the poles. A magnet has two poles - a north pole and a south pole. The poles are equal in strength.

The north pole of one magnet attracts the south pole of another magnet. The south pole of one magnet attracts the north pole of another magnet. But the north pole of one magnet repels, or pushes away, the north pole of another magnet. In the same way, the south pole of one magnet repels the south pole of a second magnet.

11. How are particles in magnetized iron different from those in unmagnetized iron?

Most magnets are made of iron. The particles that make up iron are like tiny magnets. In a normal piece of iron the particles are all mixed up. They point in different directions. In a magnetized piece of iron the particles point in the same direction.

12. How is magnetism used to produce electricity?

Magnetism can be used to produce electricity. This can be done by moving a magnet through a coil of wire. Electricity is produced as long as the magnet moves through the coil. A generator produces electricity this way.

13. What are some uses of electromagnets?

Electromagnets are often used in scrap yards to lift metal and move it. Many electromagnets are strong enough to lift heavy objects, such as cars. Electromagnets are also used in telephones.

14. In what ways are electricity and magnetism alike?

Electricity and magnetism both produce a force that can pull or push things without touching them. They both have opposite states: electricity has positive and negative, and magnetism has north-seeking and south-seeking. In both, opposite states attract and same states repel.

15. What will happen if you put a compass next to an electromagnet that is switched on?

The compass needle will turn because an electromagnet produces a magnetic field. The magnetized compass needle will move to line up with the field lines.