If an intruder was to enter your room, the last thing you should be doing is reaching for a gun. They are too close. At that point you either want to engage them hand to hand, and in this situation a knife would be good (but only if you know how to use it else it'll end up in your body not the intruders), or you want to create distance between you and the intruder in order to be affective with a firearm.
Being that the intruder will more than likely have the jump on you, a firearm would be no where near as affective as well trained hands.