(a) For the light bulb. If 5W is the power rating, you just need to make sure it does not exceeding 5W, the it is safe. For the 5 Ohms resistance. The power is
P = (V^2)/R = (9 * 9)/5 = 16.2W > 5 W
You need to add another resistor in series, or use two light bulbs in series: