There are many type of boxes available. First we will mention outlet boxes. These boxes are rectangular and house receptacles and switches. However, they come in different sizes and makeup.
Single boxes are made of plastic or metal. There are construction types that nail to a stud. These are installed before the wallboard. And there is the cut-in type that you can install afterwards. These will be used if you are installing a new switch or receptacle where there was none before.
And there are ones made specifically for outdoor use. Here are a few examples:
Single wall construction plastic box
Double gang box similar to above
plastic cut-in box (notice the tabs)
Ceiling boxes are made to fasten to the ceiling joists. They also make them in cut-in type, but are not recommended for heavy things like ceiling fans.
Typical ceiling box.
In most simple projects you will not be installing a new box. But knowing what is there will help you to better understand what you are doing.
Now it is time to talk about the importance of grounding. And you will discover what that bare wire is doing in those electric boxes.