Driving 2inch 7segment display using pic microcontroller
That won't work, in fact it's likely to kill your PIC and maybe other stuff, especially if you don't have a base resistor (as you've shown it). The E-B junction of the transistor will cause the 5V supply to rise to about 11.3V. An older midrange PIC might survive, but I think the newer ones will die for sure. 

You need a level-shifting NPN transistor (or MOSFET) as so:







simulate this circuit &ndash; Schematic created using CircuitLab

You could replace Q1 and R1 with a small-signal MOSFET such as a 2N7000 if you like.