Some sentence fragments are acceptable, although a teacher may prefer that you avoid all of them while learning to write. Intentional fragments can be found throughout good writing.
When is it okay to use sentence fragments?
In dialogue, to use an obvious example, fragments are appropriately conversational.
"Where are you going?" I asked.
"Out for a walk." She glowered at me.
Experienced writers also use fragments occasionally to create a particular effect, make a point emphatically, or answer a question they've asked:
Many of the people who drove by refused to stop and help. But not all of them.
Scorcese had offered me a bit part in the movie. The chance of a lifetime! And she wanted me to turn it down.
Why should you consider a two-year rather than a four-year college? For many reasons.
Before you consider using an intentional fragment, be sure you understand correct sentence structure, as an unintentional fragment is a glaring error. Also, be sure using a fragment is warranted: Could you achieve the effect you're after without it? In the second example above, a dash after movie would achieve the same effect that the fragment does.
Scorcese had offered me a bit part in the movie — the chance of a lifetime!